From Jason Turner

[temp.dep]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpr5q4gbof/{from.md → to.md} +50 -34
tmp/tmpr5q4gbof/{from.md → to.md} RENAMED
@@ -7,19 +7,19 @@ and/or value of template parameters (as determined by the template
7
  arguments) and this determines the context for name lookup for certain
8
  names. Expressions may be *type-dependent* (on the type of a template
9
  parameter) or *value-dependent* (on the value of a non-type template
10
  parameter). In an expression of the form:
11
 
12
- where the *postfix-expression* is an *id-expression*, the
13
- *id-expression* denotes a *dependent name* if
14
 
15
  - any of the expressions in the *expression-list* is a pack expansion (
16
  [[temp.variadic]]),
17
  - any of the expressions in the *expression-list* is a type-dependent
18
  expression ([[temp.dep.expr]]), or
19
- - if the *unqualified-id* of the *id-expression* is a *template-id* in
20
- which any of the template arguments depends on a template parameter.
21
 
22
  If an operand of an operator is a type-dependent expression, the
23
  operator also denotes a dependent name. Such names are unbound and are
24
  looked up at the point of the template instantiation ([[temp.point]])
25
  in both the context of the template definition and the context of the
@@ -151,27 +151,27 @@ template <class T1, class T2, int I> struct B {
151
  ```
152
 
153
  A name is a *member of the current instantiation* if it is
154
 
155
  - An unqualified name that, when looked up, refers to at least one
156
- member of the current instantiation or a non-dependent base class
157
- thereof. This can only occur when looking up a name in a scope
158
- enclosed by the definition of a class template.
159
  - A *qualified-id* in which the *nested-name-specifier* refers to the
160
  current instantiation and that, when looked up, refers to at least one
161
- member of the current instantiation or a non-dependent base class
162
- thereof. if no such member is found, and the current instantiation has
163
- any dependent base classes, then the *qualified-id* is a member of an
164
- unknown specialization; see below.
165
  - An *id-expression* denoting the member in a class member access
166
  expression ([[expr.ref]]) for which the type of the object expression
167
  is the current instantiation, and the *id-expression*, when looked
168
- up ([[basic.lookup.classref]]), refers to at least one member of the
169
- current instantiation or a non-dependent base class thereof. if no
170
- such member is found, and the current instantiation has any dependent
171
- base classes, then the *id-expression* is a member of an unknown
172
- specialization; see below.
173
 
174
  ``` cpp
175
  template <class T> class A {
176
  static const int i = 5;
177
  int n1[i]; // i refers to a member of the current instantiation
@@ -183,25 +183,30 @@ template <class T> class A {
183
  template <class T> int A<T>::f() {
184
  return i; // i refers to a member of the current instantiation
185
  }
186
  ```
187
 
 
 
 
 
188
  A name is a *member of an unknown specialization* if it is
189
 
190
  - A *qualified-id* in which the *nested-name-specifier* names a
191
  dependent type that is not the current instantiation.
192
  - A *qualified-id* in which the *nested-name-specifier* refers to the
193
  current instantiation, the current instantiation has at least one
194
  dependent base class, and name lookup of the *qualified-id* does not
195
- find any member of the current instantiation or a non-dependent base
196
- class thereof.
197
  - An *id-expression* denoting the member in a class member access
198
  expression ([[expr.ref]]) in which either
199
  - the type of the object expression is the current instantiation, the
200
  current instantiation has at least one dependent base class, and
201
- name lookup of the *id-expression* does not find a member of the
202
- current instantiation or a non-dependent base class thereof; or
 
203
  - the type of the object expression is dependent and is not the
204
  current instantiation.
205
 
206
  If a *qualified-id* in which the *nested-name-specifier* refers to the
207
  current instantiation is not a member of the current instantiation or a
@@ -239,12 +244,12 @@ base class of the current instantiation.
239
 
240
  A type is dependent if it is
241
 
242
  - a template parameter,
243
  - a member of an unknown specialization,
244
- - a nested class or enumeration that is a member of the current
245
- instantiation,
246
  - a cv-qualified type where the cv-unqualified type is dependent,
247
  - a compound type constructed from any dependent type,
248
  - an array type constructed from any dependent type or whose size is
249
  specified by a constant expression that is value-dependent,
250
  - a *simple-template-id* in which either the template name is a template
@@ -270,20 +275,25 @@ dependent ([[temp.dep.type]]).
270
 
271
  An *id-expression* is type-dependent if it contains
272
 
273
  - an *identifier* associated by name lookup with one or more
274
  declarations declared with a dependent type,
 
 
 
 
275
  - a *template-id* that is dependent,
276
  - a *conversion-function-id* that specifies a dependent type, or
277
  - a *nested-name-specifier* or a *qualified-id* that names a member of
278
  an unknown specialization;
279
 
280
- or if it names a static data member of the current instantiation that
281
- has type “array of unknown bound of `T`” for some `T` (
282
- [[temp.static]]). Expressions of the following forms are type-dependent
283
- only if the type specified by the *type-id*, *simple-type-specifier* or
284
- *new-type-id* is dependent, even if any subexpression is type-dependent:
 
285
 
286
  Expressions of the following forms are never type-dependent (because the
287
  type of the expression cannot be dependent):
288
 
289
  For the standard library macro `offsetof`, see  [[support.types]].
@@ -303,16 +313,21 @@ member access expression.
303
  #### Value-dependent expressions <a id="temp.dep.constexpr">[[temp.dep.constexpr]]</a>
304
 
305
  Except as described below, a constant expression is value-dependent if
306
  any subexpression is value-dependent.
307
 
308
- An *identifier* is value-dependent if it is:
309
 
310
- - a name declared with a dependent type,
311
- - the name of a non-type template parameter,
312
- - a constant with literal type and is initialized with an expression
313
- that is value-dependent.
 
 
 
 
 
314
 
315
  Expressions of the following form are value-dependent if the
316
  *unary-expression* or *expression* is type-dependent or the *type-id* is
317
  dependent:
318
 
@@ -322,12 +337,13 @@ Expressions of the following form are value-dependent if either the
322
  *type-id* or *simple-type-specifier* is dependent or the *expression* or
323
  *cast-expression* is value-dependent:
324
 
325
  Expressions of the following form are value-dependent:
326
 
327
- An *id-expression* is value-dependent if it names a member of an unknown
328
- specialization.
 
329
 
330
  #### Dependent template arguments <a id="temp.dep.temp">[[temp.dep.temp]]</a>
331
 
332
  A type *template-argument* is dependent if the type it specifies is
333
  dependent.
 
7
  arguments) and this determines the context for name lookup for certain
8
  names. Expressions may be *type-dependent* (on the type of a template
9
  parameter) or *value-dependent* (on the value of a non-type template
10
  parameter). In an expression of the form:
11
 
12
+ where the *postfix-expression* is an *unqualified-id*, the
13
+ *unqualified-id* denotes a *dependent name* if
14
 
15
  - any of the expressions in the *expression-list* is a pack expansion (
16
  [[temp.variadic]]),
17
  - any of the expressions in the *expression-list* is a type-dependent
18
  expression ([[temp.dep.expr]]), or
19
+ - if the *unqualified-id* is a *template-id* in which any of the
20
+ template arguments depends on a template parameter.
21
 
22
  If an operand of an operator is a type-dependent expression, the
23
  operator also denotes a dependent name. Such names are unbound and are
24
  looked up at the point of the template instantiation ([[temp.point]])
25
  in both the context of the template definition and the context of the
 
151
  ```
152
 
153
  A name is a *member of the current instantiation* if it is
154
 
155
  - An unqualified name that, when looked up, refers to at least one
156
+ member of a class that is the current instantiation or a non-dependent
157
+ base class thereof. This can only occur when looking up a name in a
158
+ scope enclosed by the definition of a class template.
159
  - A *qualified-id* in which the *nested-name-specifier* refers to the
160
  current instantiation and that, when looked up, refers to at least one
161
+ member of a class that is the current instantiation or a non-dependent
162
+ base class thereof. if no such member is found, and the current
163
+ instantiation has any dependent base classes, then the *qualified-id*
164
+ is a member of an unknown specialization; see below.
165
  - An *id-expression* denoting the member in a class member access
166
  expression ([[expr.ref]]) for which the type of the object expression
167
  is the current instantiation, and the *id-expression*, when looked
168
+ up ([[basic.lookup.classref]]), refers to at least one member of a
169
+ class that is the current instantiation or a non-dependent base class
170
+ thereof. if no such member is found, and the current instantiation has
171
+ any dependent base classes, then the *id-expression* is a member of an
172
+ unknown specialization; see below.
173
 
174
  ``` cpp
175
  template <class T> class A {
176
  static const int i = 5;
177
  int n1[i]; // i refers to a member of the current instantiation
 
183
  template <class T> int A<T>::f() {
184
  return i; // i refers to a member of the current instantiation
185
  }
186
  ```
187
 
188
+ A name is a *dependent member of the current instantiation* if it is a
189
+ member of the current instantiation that, when looked up, refers to at
190
+ least one member of a class that is the current instantiation.
191
+
192
  A name is a *member of an unknown specialization* if it is
193
 
194
  - A *qualified-id* in which the *nested-name-specifier* names a
195
  dependent type that is not the current instantiation.
196
  - A *qualified-id* in which the *nested-name-specifier* refers to the
197
  current instantiation, the current instantiation has at least one
198
  dependent base class, and name lookup of the *qualified-id* does not
199
+ find any member of a class that is the current instantiation or a
200
+ non-dependent base class thereof.
201
  - An *id-expression* denoting the member in a class member access
202
  expression ([[expr.ref]]) in which either
203
  - the type of the object expression is the current instantiation, the
204
  current instantiation has at least one dependent base class, and
205
+ name lookup of the *id-expression* does not find a member of a class
206
+ that is the current instantiation or a non-dependent base class
207
+ thereof; or
208
  - the type of the object expression is dependent and is not the
209
  current instantiation.
210
 
211
  If a *qualified-id* in which the *nested-name-specifier* refers to the
212
  current instantiation is not a member of the current instantiation or a
 
244
 
245
  A type is dependent if it is
246
 
247
  - a template parameter,
248
  - a member of an unknown specialization,
249
+ - a nested class or enumeration that is a dependent member of the
250
+ current instantiation,
251
  - a cv-qualified type where the cv-unqualified type is dependent,
252
  - a compound type constructed from any dependent type,
253
  - an array type constructed from any dependent type or whose size is
254
  specified by a constant expression that is value-dependent,
255
  - a *simple-template-id* in which either the template name is a template
 
275
 
276
  An *id-expression* is type-dependent if it contains
277
 
278
  - an *identifier* associated by name lookup with one or more
279
  declarations declared with a dependent type,
280
+ - an *identifier* associated by name lookup with one or more
281
+ declarations of member functions of the current instantiation declared
282
+ with a return type that contains a placeholder type (
283
+ [[dcl.spec.auto]]),
284
  - a *template-id* that is dependent,
285
  - a *conversion-function-id* that specifies a dependent type, or
286
  - a *nested-name-specifier* or a *qualified-id* that names a member of
287
  an unknown specialization;
288
 
289
+ or if it names a dependent member of the current instantiation that is a
290
+ static data member of type “array of unknown bound of `T`” for some
291
+ `T` ([[temp.static]]). Expressions of the following forms are
292
+ type-dependent only if the type specified by the *type-id*,
293
+ *simple-type-specifier* or *new-type-id* is dependent, even if any
294
+ subexpression is type-dependent:
295
 
296
  Expressions of the following forms are never type-dependent (because the
297
  type of the expression cannot be dependent):
298
 
299
  For the standard library macro `offsetof`, see  [[support.types]].
 
313
  #### Value-dependent expressions <a id="temp.dep.constexpr">[[temp.dep.constexpr]]</a>
314
 
315
  Except as described below, a constant expression is value-dependent if
316
  any subexpression is value-dependent.
317
 
318
+ An *id-expression* is value-dependent if:
319
 
320
+ - it is a name declared with a dependent type,
321
+ - it is the name of a non-type template parameter,
322
+ - it names a member of an unknown specialization,
323
+ - it names a static data member that is a dependent member of the
324
+ current instantiation and is not initialized in a *member-declarator*,
325
+ - it names a static member function that is a dependent member of the
326
+ current instantiation, or
327
+ - it is a constant with literal type and is initialized with an
328
+ expression that is value-dependent.
329
 
330
  Expressions of the following form are value-dependent if the
331
  *unary-expression* or *expression* is type-dependent or the *type-id* is
332
  dependent:
333
 
 
337
  *type-id* or *simple-type-specifier* is dependent or the *expression* or
338
  *cast-expression* is value-dependent:
339
 
340
  Expressions of the following form are value-dependent:
341
 
342
+ An expression of the form `&`*qualified-id* where the *qualified-id*
343
+ names a dependent member of the current instantiation is
344
+ value-dependent.
345
 
346
  #### Dependent template arguments <a id="temp.dep.temp">[[temp.dep.temp]]</a>
347
 
348
  A type *template-argument* is dependent if the type it specifies is
349
  dependent.