From Jason Turner

[temp.dep.type]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpl0d0sfvc/{from.md → to.md} +52 -14
tmp/tmpl0d0sfvc/{from.md → to.md} RENAMED
@@ -10,25 +10,25 @@ A name or *template-id* refers to the *current instantiation* if it is
10
  class template, the name of the class template followed by the
11
  template argument list of its *template-head* [[temp.arg]] enclosed in
12
  `<>` (or an equivalent template alias specialization),
13
  - in the definition of a nested class of a class template, the name of
14
  the nested class referenced as a member of the current instantiation,
15
- or
16
  - in the definition of a class template partial specialization or a
17
  member of a class template partial specialization, the name of the
18
  class template followed by a template argument list equivalent to that
19
  of the partial specialization [[temp.spec.partial]] enclosed in `<>`
20
- (or an equivalent template alias specialization).
 
 
21
 
22
  A template argument that is equivalent to a template parameter can be
23
  used in place of that template parameter in a reference to the current
24
- instantiation. For a template *type-parameter*, a template argument is
25
- equivalent to a template parameter if it denotes the same type. For a
26
- non-type template parameter, a template argument is equivalent to a
27
- template parameter if it is an *identifier* that names a variable that
28
- is equivalent to the template parameter. A variable is equivalent to a
29
- template parameter if
30
 
31
  - it has the same type as the template parameter (ignoring
32
  cv-qualification) and
33
  - its initializer consists of a single *identifier* that names the
34
  template parameter or, recursively, such a variable.
@@ -140,11 +140,11 @@ A qualified name [[basic.lookup.qual]] is dependent if
140
  - it is a *conversion-function-id* whose *conversion-type-id* is
141
  dependent, or
142
  - its lookup context is dependent and is not the current instantiation,
143
  or
144
  - its lookup context is the current instantiation and it is
145
- `operator=`,[^11] or
146
  - its lookup context is the current instantiation and has at least one
147
  dependent base class, and qualified name lookup for the name finds
148
  nothing [[basic.lookup.qual]].
149
 
150
  [*Example 4*:
@@ -188,11 +188,44 @@ struct C : A, T {
188
  int g() { return m; } // finds A::m in the template definition context
189
  };
190
 
191
  template int C<B>::f(); // error: finds both A::m and B::m
192
  template int C<B>::g(); // OK, transformation to class member access syntax
193
- // does not occur in the template definition context; see~[class.mfct.non.static]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  ```
195
 
196
  — *end example*]
197
 
198
  A type is dependent if it is
@@ -206,16 +239,21 @@ A type is dependent if it is
206
  - an array type whose element type is dependent or whose bound (if any)
207
  is value-dependent,
208
  - a function type whose parameters include one or more function
209
  parameter packs,
210
  - a function type whose exception specification is value-dependent,
 
 
211
  - denoted by a *simple-template-id* in which either the template name is
212
- a template parameter or any of the template arguments is a dependent
213
- type or an expression that is type-dependent or value-dependent or is
214
- a pack expansion,[^12] or
215
  - denoted by `decltype(`*expression*`)`, where *expression* is
216
- type-dependent [[temp.dep.expr]].
 
 
 
217
 
218
  [*Note 3*: Because typedefs do not introduce new types, but instead
219
  simply refer to other types, a name that refers to a typedef that is a
220
  member of the current instantiation is dependent only if the type
221
  referred to is dependent. — *end note*]
 
10
  class template, the name of the class template followed by the
11
  template argument list of its *template-head* [[temp.arg]] enclosed in
12
  `<>` (or an equivalent template alias specialization),
13
  - in the definition of a nested class of a class template, the name of
14
  the nested class referenced as a member of the current instantiation,
 
15
  - in the definition of a class template partial specialization or a
16
  member of a class template partial specialization, the name of the
17
  class template followed by a template argument list equivalent to that
18
  of the partial specialization [[temp.spec.partial]] enclosed in `<>`
19
+ (or an equivalent template alias specialization), or
20
+ - in the definition of a templated function, the name of a local class
21
+ [[class.local]].
22
 
23
  A template argument that is equivalent to a template parameter can be
24
  used in place of that template parameter in a reference to the current
25
+ instantiation. A template argument is equivalent to a type template
26
+ parameter if it denotes the same type. A template argument is equivalent
27
+ to a constant template parameter if it is an *identifier* that names a
28
+ variable that is equivalent to the template parameter. A variable is
29
+ equivalent to a template parameter if
 
30
 
31
  - it has the same type as the template parameter (ignoring
32
  cv-qualification) and
33
  - its initializer consists of a single *identifier* that names the
34
  template parameter or, recursively, such a variable.
 
140
  - it is a *conversion-function-id* whose *conversion-type-id* is
141
  dependent, or
142
  - its lookup context is dependent and is not the current instantiation,
143
  or
144
  - its lookup context is the current instantiation and it is
145
+ `operator=`,[^10] or
146
  - its lookup context is the current instantiation and has at least one
147
  dependent base class, and qualified name lookup for the name finds
148
  nothing [[basic.lookup.qual]].
149
 
150
  [*Example 4*:
 
188
  int g() { return m; } // finds A::m in the template definition context
189
  };
190
 
191
  template int C<B>::f(); // error: finds both A::m and B::m
192
  template int C<B>::g(); // OK, transformation to class member access syntax
193
+ // does not occur in the template definition context; see~[expr.prim.id.general]
194
+ ```
195
+
196
+ — *end example*]
197
+
198
+ An initializer is dependent if any constituent expression
199
+ [[intro.execution]] of the initializer is type-dependent. A placeholder
200
+ type [[dcl.spec.auto.general]] is dependent if it designates a type
201
+ deduced from a dependent initializer.
202
+
203
+ A placeholder for a deduced class type [[dcl.type.class.deduct]] is
204
+ dependent if
205
+
206
+ - it has a dependent initializer, or
207
+ - it refers to an alias template that is a member of the current
208
+ instantiation and whose *defining-type-id* is dependent after class
209
+ template argument deduction [[over.match.class.deduct]] and
210
+ substitution [[temp.alias]].
211
+
212
+ [*Example 6*:
213
+
214
+ ``` cpp
215
+ template<class T, class V>
216
+ struct S { S(T); };
217
+
218
+ template<class U>
219
+ struct A {
220
+ template<class T> using X = S<T, U>;
221
+ template<class T> using Y = S<T, int>;
222
+ void f() {
223
+ new X(1); // dependent
224
+ new Y(1); // not dependent
225
+ }
226
+ };
227
  ```
228
 
229
  — *end example*]
230
 
231
  A type is dependent if it is
 
239
  - an array type whose element type is dependent or whose bound (if any)
240
  is value-dependent,
241
  - a function type whose parameters include one or more function
242
  parameter packs,
243
  - a function type whose exception specification is value-dependent,
244
+ - denoted by a dependent placeholder type,
245
+ - denoted by a dependent placeholder for a deduced class type,
246
  - denoted by a *simple-template-id* in which either the template name is
247
+ a template parameter or any of the template arguments is dependent
248
+ [[temp.dep.temp]],[^11]
249
+ - a *pack-index-specifier*,
250
  - denoted by `decltype(`*expression*`)`, where *expression* is
251
+ type-dependent [[temp.dep.expr]], or
252
+ - denoted by a *splice-type-specifier* in which either the
253
+ *splice-specifier* or *splice-specialization-specifier* is dependent
254
+ [[temp.dep.splice]].
255
 
256
  [*Note 3*: Because typedefs do not introduce new types, but instead
257
  simply refer to other types, a name that refers to a typedef that is a
258
  member of the current instantiation is dependent only if the type
259
  referred to is dependent. — *end note*]