From Jason Turner

[temp.dep]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp42u179_k/{from.md → to.md} +151 -53
tmp/tmp42u179_k/{from.md → to.md} RENAMED
@@ -3,30 +3,34 @@
3
  Inside a template, some constructs have semantics which may differ from
4
  one instantiation to another. Such a construct *depends* on the template
5
  parameters. In particular, types and expressions may depend on the type
6
  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 *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
26
  point of instantiation.
27
 
 
 
28
  ``` cpp
29
  template<class T> struct X : B<T> {
30
  typename T::A* pa;
31
  void f(B<T>* pb) {
32
  static int i = B<T>::i;
@@ -36,15 +40,18 @@ template<class T> struct X : B<T> {
36
  ```
37
 
38
  the base class name `B<T>`, the type name `T::A`, the names `B<T>::i`
39
  and `pb->j` explicitly depend on the *template-parameter*.
40
 
41
- In the definition of a class or class template, if a base class depends
42
- on a *template-parameter*, the base class scope is not examined during
43
- unqualified name lookup either at the point of definition of the class
44
- template or member or during an instantiation of the class template or
45
- member.
 
 
 
46
 
47
  ``` cpp
48
  typedef double A;
49
  template<class T> class B {
50
  typedef int A;
@@ -56,21 +63,25 @@ template<class T> struct X : B<T> {
56
 
57
  The type name `A` in the definition of `X<T>` binds to the typedef name
58
  defined in the global namespace scope, not to the typedef name defined
59
  in the base class `B<T>`.
60
 
 
 
 
 
61
  ``` cpp
62
  struct A {
63
- struct B { /* ... */ };
64
  int a;
65
  int Y;
66
  };
67
 
68
  int a;
69
 
70
  template<class T> struct Y : T {
71
- struct B { /* ... */ };
72
  B b; // The B defined in Y
73
  void f(int i) { a = i; } // ::a
74
  Y* p; // Y<T>
75
  };
76
 
@@ -78,10 +89,12 @@ Y<A> ya;
78
  ```
79
 
80
  The members `A::B`, `A::a`, and `A::Y` of the template argument `A` do
81
  not affect the binding of names in `Y<A>`.
82
 
 
 
83
  #### Dependent types <a id="temp.dep.type">[[temp.dep.type]]</a>
84
 
85
  A name refers to the *current instantiation* if it is
86
 
87
  - in the definition of a class template, a nested class of a class
@@ -116,21 +129,22 @@ can be used in place of that template parameter in a reference to the
116
  current instantiation. In the case of a non-type template argument, the
117
  argument must have been given the value of the template parameter and
118
  not an expression in which the template parameter appears as a
119
  subexpression.
120
 
 
 
121
  ``` cpp
122
  template <class T> class A {
123
  A* p1; // A is the current instantiation
124
  A<T>* p2; // A<T> is the current instantiation
125
  A<T*> p3; // A<T*> is not the current instantiation
126
  ::A<T>* p4; // ::A<T> is the current instantiation
127
  class B {
128
  B* p1; // B is the current instantiation
129
  A<T>::B* p2; // A<T>::B is the current instantiation
130
- typename A<T*>::B* p3; // A<T*>::B is not the
131
- // current instantiation
132
  };
133
  };
134
 
135
  template <class T> class A<T*> {
136
  A<T*>* p1; // A<T*> is the current instantiation
@@ -148,30 +162,64 @@ template <class T1, class T2, int I> struct B {
148
  B<my_T1, T2, my_I2>* b4; // not the current instantiation
149
  B<my_T1, T2, my_I3>* b5; // refers to the current instantiation
150
  };
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,10 +231,12 @@ 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 *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
@@ -217,10 +267,12 @@ access expression for which the type of the object expression is the
217
  current instantiation does not refer to a member of the current
218
  instantiation or a member of an unknown specialization, the program is
219
  ill-formed even if the template containing the member access expression
220
  is not instantiated; no diagnostic required.
221
 
 
 
222
  ``` cpp
223
  template<class T> class A {
224
  typedef int type;
225
  void f() {
226
  A<T>::type i; // OK: refers to a member of the current instantiation
@@ -228,42 +280,68 @@ template<class T> class A {
228
  // a member of an unknown specialization
229
  }
230
  };
231
  ```
232
 
 
 
233
  If, for a given set of template arguments, a specialization of a
234
  template is instantiated that refers to a member of the current
235
  instantiation with a *qualified-id* or class member access expression,
236
  the name in the *qualified-id* or class member access expression is
237
  looked up in the template instantiation context. If the result of this
238
  lookup differs from the result of name lookup in the template definition
239
- context, name lookup is ambiguous. the result of name lookup differs
240
- only when the member of the current instantiation was found in a
241
- non-dependent base class of the current instantiation and a member with
242
- the same name is also introduced by the substitution for a dependent
243
- base class of the current instantiation.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
256
  parameter or any of the template arguments is a dependent type or an
257
- expression that is type-dependent or value-dependent, or
 
 
 
258
  - denoted by `decltype(`*expression*`)`, where *expression* is
259
  type-dependent ([[temp.dep.expr]]).
260
 
261
- Because typedefs do not introduce new types, but instead simply refer to
262
- other types, a name that refers to a typedef that is a member of the
263
- current instantiation is dependent only if the type referred to is
264
- dependent.
265
 
266
  #### Type-dependent expressions <a id="temp.dep.expr">[[temp.dep.expr]]</a>
267
 
268
  Except as described below, an expression is type-dependent if any
269
  subexpression is type-dependent.
@@ -275,14 +353,22 @@ dependent ([[temp.dep.type]]).
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
 
@@ -294,34 +380,41 @@ type-dependent only if the type specified by the *type-id*,
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]].
 
300
 
301
  A class member access expression ([[expr.ref]]) is type-dependent if
302
  the expression refers to a member of the current instantiation and the
303
  type of the referenced member is dependent, or the class member access
304
- expression refers to a member of an unknown specialization. In an
305
- expression of the form `x.y` or `xp->y` the type of the expression is
306
- usually the type of the member `y` of the class of `x` (or the class
307
- pointed to by `xp`). However, if `x` or `xp` refers to a dependent type
308
- that is not the current instantiation, the type of `y` is always
309
- dependent. If `x` or `xp` refers to a non-dependent type or refers to
310
- the current instantiation, the type of `y` is the type of the class
311
- member access expression.
 
 
 
 
 
 
312
 
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
@@ -329,21 +422,26 @@ An *id-expression* is value-dependent if:
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
 
334
- For the standard library macro `offsetof`, see  [[support.types]].
 
335
 
336
  Expressions of the following form are value-dependent if either the
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.
 
3
  Inside a template, some constructs have semantics which may differ from
4
  one instantiation to another. Such a construct *depends* on the template
5
  parameters. In particular, types and expressions may depend on the type
6
  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. An expressions may be *type-dependent* (that is, its type may
9
+ depend on a template parameter) or *value-dependent* (that is, its value
10
+ when evaluated as a constant expression ([[expr.const]]) may depend on
11
+ a template parameter) as described in this subclause. In an expression
12
+ of the form:
13
 
14
  where the *postfix-expression* is an *unqualified-id*, the
15
  *unqualified-id* denotes a *dependent name* if
16
 
17
  - any of the expressions in the *expression-list* is a pack expansion (
18
  [[temp.variadic]]),
19
+ - any of the expressions or *braced-init-list*s in the *expression-list*
20
+ is type-dependent ([[temp.dep.expr]]), or
21
+ - the *unqualified-id* is a *template-id* in which any of the template
22
+ arguments depends on a template parameter.
23
 
24
  If an operand of an operator is a type-dependent expression, the
25
  operator also denotes a dependent name. Such names are unbound and are
26
  looked up at the point of the template instantiation ([[temp.point]])
27
  in both the context of the template definition and the context of the
28
  point of instantiation.
29
 
30
+ [*Example 1*:
31
+
32
  ``` cpp
33
  template<class T> struct X : B<T> {
34
  typename T::A* pa;
35
  void f(B<T>* pb) {
36
  static int i = B<T>::i;
 
40
  ```
41
 
42
  the base class name `B<T>`, the type name `T::A`, the names `B<T>::i`
43
  and `pb->j` explicitly depend on the *template-parameter*.
44
 
45
+ *end example*]
46
+
47
+ In the definition of a class or class template, the scope of a dependent
48
+ base class ([[temp.dep.type]]) is not examined during unqualified name
49
+ lookup either at the point of definition of the class template or member
50
+ or during an instantiation of the class template or member.
51
+
52
+ [*Example 2*:
53
 
54
  ``` cpp
55
  typedef double A;
56
  template<class T> class B {
57
  typedef int A;
 
63
 
64
  The type name `A` in the definition of `X<T>` binds to the typedef name
65
  defined in the global namespace scope, not to the typedef name defined
66
  in the base class `B<T>`.
67
 
68
+ — *end example*]
69
+
70
+ [*Example 3*:
71
+
72
  ``` cpp
73
  struct A {
74
+ struct B { ... };
75
  int a;
76
  int Y;
77
  };
78
 
79
  int a;
80
 
81
  template<class T> struct Y : T {
82
+ struct B { ... };
83
  B b; // The B defined in Y
84
  void f(int i) { a = i; } // ::a
85
  Y* p; // Y<T>
86
  };
87
 
 
89
  ```
90
 
91
  The members `A::B`, `A::a`, and `A::Y` of the template argument `A` do
92
  not affect the binding of names in `Y<A>`.
93
 
94
+ — *end example*]
95
+
96
  #### Dependent types <a id="temp.dep.type">[[temp.dep.type]]</a>
97
 
98
  A name refers to the *current instantiation* if it is
99
 
100
  - in the definition of a class template, a nested class of a class
 
129
  current instantiation. In the case of a non-type template argument, the
130
  argument must have been given the value of the template parameter and
131
  not an expression in which the template parameter appears as a
132
  subexpression.
133
 
134
+ [*Example 1*:
135
+
136
  ``` cpp
137
  template <class T> class A {
138
  A* p1; // A is the current instantiation
139
  A<T>* p2; // A<T> is the current instantiation
140
  A<T*> p3; // A<T*> is not the current instantiation
141
  ::A<T>* p4; // ::A<T> is the current instantiation
142
  class B {
143
  B* p1; // B is the current instantiation
144
  A<T>::B* p2; // A<T>::B is the current instantiation
145
+ typename A<T*>::B* p3; // A<T*>::B is not the current instantiation
 
146
  };
147
  };
148
 
149
  template <class T> class A<T*> {
150
  A<T*>* p1; // A<T*> is the current instantiation
 
162
  B<my_T1, T2, my_I2>* b4; // not the current instantiation
163
  B<my_T1, T2, my_I3>* b5; // refers to the current instantiation
164
  };
165
  ```
166
 
167
+ — *end example*]
168
+
169
+ A *dependent base class* is a base class that is a dependent type and is
170
+ not the current instantiation.
171
+
172
+ [*Note 1*:
173
+
174
+ A base class can be the current instantiation in the case of a nested
175
+ class naming an enclosing class as a base.
176
+
177
+ [*Example 2*:
178
+
179
+ ``` cpp
180
+ template<class T> struct A {
181
+ typedef int M;
182
+ struct B {
183
+ typedef void M;
184
+ struct C;
185
+ };
186
+ };
187
+
188
+ template<class T> struct A<T>::B::C : A<T> {
189
+ M m; // OK, A<T>::M
190
+ };
191
+ ```
192
+
193
+ — *end example*]
194
+
195
+ — *end note*]
196
+
197
  A name is a *member of the current instantiation* if it is
198
 
199
  - An unqualified name that, when looked up, refers to at least one
200
  member of a class that is the current instantiation or a non-dependent
201
+ base class thereof. \[*Note 2*: This can only occur when looking up a
202
+ name in a scope enclosed by the definition of a class
203
+ template. — *end note*]
204
  - A *qualified-id* in which the *nested-name-specifier* refers to the
205
  current instantiation and that, when looked up, refers to at least one
206
  member of a class that is the current instantiation or a non-dependent
207
+ base class thereof. \[*Note 3*: If no such member is found, and the
208
+ current instantiation has any dependent base classes, then the
209
+ *qualified-id* is a member of an unknown specialization; see
210
+ below. — *end note*]
211
  - An *id-expression* denoting the member in a class member access
212
  expression ([[expr.ref]]) for which the type of the object expression
213
  is the current instantiation, and the *id-expression*, when looked
214
  up ([[basic.lookup.classref]]), refers to at least one member of a
215
  class that is the current instantiation or a non-dependent base class
216
+ thereof. \[*Note 4*: If no such member is found, and the current
217
+ instantiation has any dependent base classes, then the *id-expression*
218
+ is a member of an unknown specialization; see below. — *end note*]
219
+
220
+ [*Example 3*:
221
 
222
  ``` cpp
223
  template <class T> class A {
224
  static const int i = 5;
225
  int n1[i]; // i refers to a member of the current instantiation
 
231
  template <class T> int A<T>::f() {
232
  return i; // i refers to a member of the current instantiation
233
  }
234
  ```
235
 
236
+ — *end example*]
237
+
238
  A name is a *dependent member of the current instantiation* if it is a
239
  member of the current instantiation that, when looked up, refers to at
240
  least one member of a class that is the current instantiation.
241
 
242
  A name is a *member of an unknown specialization* if it is
 
267
  current instantiation does not refer to a member of the current
268
  instantiation or a member of an unknown specialization, the program is
269
  ill-formed even if the template containing the member access expression
270
  is not instantiated; no diagnostic required.
271
 
272
+ [*Example 4*:
273
+
274
  ``` cpp
275
  template<class T> class A {
276
  typedef int type;
277
  void f() {
278
  A<T>::type i; // OK: refers to a member of the current instantiation
 
280
  // a member of an unknown specialization
281
  }
282
  };
283
  ```
284
 
285
+ — *end example*]
286
+
287
  If, for a given set of template arguments, a specialization of a
288
  template is instantiated that refers to a member of the current
289
  instantiation with a *qualified-id* or class member access expression,
290
  the name in the *qualified-id* or class member access expression is
291
  looked up in the template instantiation context. If the result of this
292
  lookup differs from the result of name lookup in the template definition
293
+ context, name lookup is ambiguous.
294
+
295
+ [*Example 5*:
296
+
297
+ ``` cpp
298
+ struct A {
299
+ int m;
300
+ };
301
+
302
+ struct B {
303
+ int m;
304
+ };
305
+
306
+ template<typename T>
307
+ struct C : A, T {
308
+ int f() { return this->m; } // finds A::m in the template definition context
309
+ int g() { return m; } // finds A::m in the template definition context
310
+ };
311
+
312
+ template int C<B>::f(); // error: finds both A::m and B::m
313
+ template int C<B>::g(); // OK: transformation to class member access syntax
314
+ // does not occur in the template definition context; see~[class.mfct.non-static]
315
+ ```
316
+
317
+ — *end example*]
318
 
319
  A type is dependent if it is
320
 
321
  - a template parameter,
322
  - a member of an unknown specialization,
323
  - a nested class or enumeration that is a dependent member of the
324
  current instantiation,
325
  - a cv-qualified type where the cv-unqualified type is dependent,
326
  - a compound type constructed from any dependent type,
327
+ - an array type whose element type is dependent or whose bound (if any)
328
+ is value-dependent,
329
+ - a function type whose exception specification is value-dependent,
330
  - a *simple-template-id* in which either the template name is a template
331
  parameter or any of the template arguments is a dependent type or an
332
+ expression that is type-dependent or value-dependent or is a pack
333
+ expansion \[*Note 5*: This includes an injected-class-name (Clause
334
+ [[class]]) of a class template used without a
335
+ *template-argument-list*. — *end note*] , or
336
  - denoted by `decltype(`*expression*`)`, where *expression* is
337
  type-dependent ([[temp.dep.expr]]).
338
 
339
+ [*Note 6*: Because typedefs do not introduce new types, but instead
340
+ simply refer to other types, a name that refers to a typedef that is a
341
+ member of the current instantiation is dependent only if the type
342
+ referred to is dependent. — *end note*]
343
 
344
  #### Type-dependent expressions <a id="temp.dep.expr">[[temp.dep.expr]]</a>
345
 
346
  Except as described below, an expression is type-dependent if any
347
  subexpression is type-dependent.
 
353
 
354
  An *id-expression* is type-dependent if it contains
355
 
356
  - an *identifier* associated by name lookup with one or more
357
  declarations declared with a dependent type,
358
+ - an *identifier* associated by name lookup with a non-type
359
+ *template-parameter* declared with a type that contains a placeholder
360
+ type ([[dcl.spec.auto]]),
361
  - an *identifier* associated by name lookup with one or more
362
  declarations of member functions of the current instantiation declared
363
+ with a return type that contains a placeholder type,
364
+ - an *identifier* associated by name lookup with a structured binding
365
+ declaration ([[dcl.struct.bind]]) whose *brace-or-equal-initializer*
366
+ is type-dependent,
367
+ - the *identifier* `__func__` ([[dcl.fct.def.general]]), where any
368
+ enclosing function is a template, a member of a class template, or a
369
+ generic lambda,
370
  - a *template-id* that is dependent,
371
  - a *conversion-function-id* that specifies a dependent type, or
372
  - a *nested-name-specifier* or a *qualified-id* that names a member of
373
  an unknown specialization;
374
 
 
380
  subexpression is type-dependent:
381
 
382
  Expressions of the following forms are never type-dependent (because the
383
  type of the expression cannot be dependent):
384
 
385
+ [*Note 1*: For the standard library macro `offsetof`, see 
386
+ [[support.types]]. — *end note*]
387
 
388
  A class member access expression ([[expr.ref]]) is type-dependent if
389
  the expression refers to a member of the current instantiation and the
390
  type of the referenced member is dependent, or the class member access
391
+ expression refers to a member of an unknown specialization.
392
+
393
+ [*Note 2*: In an expression of the form `x.y` or `xp->y` the type of
394
+ the expression is usually the type of the member `y` of the class of `x`
395
+ (or the class pointed to by `xp`). However, if `x` or `xp` refers to a
396
+ dependent type that is not the current instantiation, the type of `y` is
397
+ always dependent. If `x` or `xp` refers to a non-dependent type or
398
+ refers to the current instantiation, the type of `y` is the type of the
399
+ class member access expression. — *end note*]
400
+
401
+ A *braced-init-list* is type-dependent if any element is type-dependent
402
+ or is a pack expansion.
403
+
404
+ A *fold-expression* is type-dependent.
405
 
406
  #### Value-dependent expressions <a id="temp.dep.constexpr">[[temp.dep.constexpr]]</a>
407
 
408
+ Except as described below, an expression used in a context where a
409
+ constant expression is required is value-dependent if any subexpression
410
+ is value-dependent.
411
 
412
  An *id-expression* is value-dependent if:
413
 
414
+ - it is type-dependent,
415
  - it is the name of a non-type template parameter,
 
416
  - it names a static data member that is a dependent member of the
417
  current instantiation and is not initialized in a *member-declarator*,
418
  - it names a static member function that is a dependent member of the
419
  current instantiation, or
420
  - it is a constant with literal type and is initialized with an
 
422
 
423
  Expressions of the following form are value-dependent if the
424
  *unary-expression* or *expression* is type-dependent or the *type-id* is
425
  dependent:
426
 
427
+ [*Note 1*: For the standard library macro `offsetof`, see 
428
+ [[support.types]]. — *end note*]
429
 
430
  Expressions of the following form are value-dependent if either the
431
  *type-id* or *simple-type-specifier* is dependent or the *expression* or
432
  *cast-expression* is value-dependent:
433
 
434
  Expressions of the following form are value-dependent:
435
 
436
  An expression of the form `&`*qualified-id* where the *qualified-id*
437
  names a dependent member of the current instantiation is
438
+ value-dependent. An expression of the form `&`*cast-expression* is also
439
+ value-dependent if evaluating *cast-expression* as a core constant
440
+ expression ([[expr.const]]) succeeds and the result of the evaluation
441
+ refers to a templated entity that is an object with static or thread
442
+ storage duration or a member function.
443
 
444
  #### Dependent template arguments <a id="temp.dep.temp">[[temp.dep.temp]]</a>
445
 
446
  A type *template-argument* is dependent if the type it specifies is
447
  dependent.