- tmp/tmpn0taz01d/{from.md → to.md} +260 -56
tmp/tmpn0taz01d/{from.md → to.md}
RENAMED
|
@@ -87,11 +87,11 @@ specialization [[temp.point]] but is not found by lookup for the
|
|
| 87 |
specialization, the program is ill-formed, no diagnostic required.
|
| 88 |
|
| 89 |
``` bnf
|
| 90 |
typename-specifier:
|
| 91 |
typename nested-name-specifier identifier
|
| 92 |
-
typename nested-name-specifier
|
| 93 |
```
|
| 94 |
|
| 95 |
The component names of a *typename-specifier* are its *identifier* (if
|
| 96 |
any) and those of its *nested-name-specifier* and *simple-template-id*
|
| 97 |
(if any). A *typename-specifier* denotes the type or class template
|
|
@@ -122,48 +122,60 @@ void foo() {
|
|
| 122 |
}
|
| 123 |
```
|
| 124 |
|
| 125 |
— *end example*]
|
| 126 |
|
| 127 |
-
A
|
| 128 |
-
if it is the terminal name of
|
| 129 |
|
| 130 |
-
- a *typename-specifier*, *nested-name-specifier*,
|
| 131 |
-
*elaborated-type-specifier*, *class-or-decltype*,
|
|
|
|
|
|
|
| 132 |
- a *type-specifier* of a
|
| 133 |
- *new-type-id*,
|
| 134 |
- *defining-type-id*,
|
| 135 |
- *conversion-type-id*,
|
| 136 |
- *trailing-return-type*,
|
| 137 |
- default argument of a *type-parameter*, or
|
| 138 |
- *type-id* of a `static_cast`, `const_cast`, `reinterpret_cast`, or
|
| 139 |
`dynamic_cast`, or
|
| 140 |
- a *decl-specifier* of the *decl-specifier-seq* of a
|
| 141 |
-
- *simple-declaration* or
|
| 142 |
- *member-declaration*,
|
| 143 |
-
- *parameter-declaration* in a *member-declaration*,[^
|
| 144 |
*parameter-declaration* appears in a default argument,
|
| 145 |
- *parameter-declaration* in a *declarator* of a function or function
|
| 146 |
template declaration whose *declarator-id* is qualified, unless that
|
| 147 |
*parameter-declaration* appears in a default argument,
|
| 148 |
- *parameter-declaration* in a *lambda-declarator* or
|
| 149 |
*requirement-parameter-list*, unless that *parameter-declaration*
|
| 150 |
appears in a default argument, or
|
| 151 |
-
- *parameter-declaration* of a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
[*Example 5*:
|
| 154 |
|
| 155 |
``` cpp
|
| 156 |
template<class T> T::R f(); // OK, return type of a function declaration at global scope
|
| 157 |
template<class T> void f(T::R); // ill-formed, no diagnostic required: attempt to declare
|
| 158 |
// a void variable template
|
|
|
|
| 159 |
template<class T> struct S {
|
| 160 |
using Ptr = PtrTraits<T>::Ptr; // OK, in a defining-type-id
|
|
|
|
| 161 |
T::R f(T::P p) { // OK, class scope
|
| 162 |
return static_cast<T::R>(p); // OK, type-id of a static_cast
|
| 163 |
}
|
| 164 |
auto g() -> S<T*>::Ptr; // OK, trailing-return-type
|
|
|
|
|
|
|
| 165 |
};
|
| 166 |
template<typename T> void f() {
|
| 167 |
void (*pf)(T::X); // variable pf of type void* initialized with T::X
|
| 168 |
void g(T::X); // error: T::X at block scope does not denote a type
|
| 169 |
// (attempt to declare a void variable)
|
|
@@ -198,33 +210,45 @@ int main() {
|
|
| 198 |
}
|
| 199 |
```
|
| 200 |
|
| 201 |
— *end example*]
|
| 202 |
|
| 203 |
-
The validity of a
|
|
|
|
| 204 |
|
| 205 |
[*Note 3*: Knowing which names are type names allows the syntax of
|
| 206 |
every template to be checked in this way. — *end note*]
|
| 207 |
|
| 208 |
-
The program is ill-formed, no diagnostic required, if
|
| 209 |
|
| 210 |
- no valid specialization, ignoring *static_assert-declaration*s that
|
| 211 |
-
fail, can be generated for a
|
| 212 |
-
if statement [[stmt.if]] within a
|
|
|
|
| 213 |
instantiated, or
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
- any *constraint-expression* in the program, introduced or otherwise,
|
| 215 |
has (in its normal form) an atomic constraint A where no satisfaction
|
| 216 |
check of A could be well-formed and no satisfaction check of A is
|
| 217 |
performed, or
|
| 218 |
- every valid specialization of a variadic template requires an empty
|
| 219 |
template parameter pack, or
|
| 220 |
-
- a hypothetical instantiation of a
|
| 221 |
-
definition would be ill-formed due to a construct
|
| 222 |
-
|
|
|
|
| 223 |
- the interpretation of such a construct in the hypothetical
|
| 224 |
instantiation is different from the interpretation of the
|
| 225 |
-
corresponding construct in any actual instantiation of the
|
|
|
|
| 226 |
|
| 227 |
[*Note 4*:
|
| 228 |
|
| 229 |
This can happen in situations including the following:
|
| 230 |
|
|
@@ -255,13 +279,10 @@ This can happen in situations including the following:
|
|
| 255 |
it names an explicit specialization that was not declared when the
|
| 256 |
template was defined.
|
| 257 |
|
| 258 |
— *end note*]
|
| 259 |
|
| 260 |
-
Otherwise, no diagnostic shall be issued for a template for which a
|
| 261 |
-
valid specialization can be generated.
|
| 262 |
-
|
| 263 |
[*Note 5*: If a template is instantiated, errors will be diagnosed
|
| 264 |
according to the other rules in this document. Exactly when these errors
|
| 265 |
are diagnosed is a quality of implementation issue. — *end note*]
|
| 266 |
|
| 267 |
[*Example 7*:
|
|
@@ -298,12 +319,12 @@ considered definitions [[temp.decls]]. — *end note*]
|
|
| 298 |
### Locally declared names <a id="temp.local">[[temp.local]]</a>
|
| 299 |
|
| 300 |
Like normal (non-template) classes, class templates have an
|
| 301 |
injected-class-name [[class.pre]]. The injected-class-name can be used
|
| 302 |
as a *template-name* or a *type-name*. When it is used with a
|
| 303 |
-
*template-argument-list*, as a *template-argument* for a template
|
| 304 |
-
|
| 305 |
*elaborated-type-specifier* of a friend class template declaration, it
|
| 306 |
is a *template-name* that refers to the class template itself.
|
| 307 |
Otherwise, it is a *type-name* equivalent to the *template-name*
|
| 308 |
followed by the template argument list
|
| 309 |
[[temp.decls.general]], [[temp.arg.general]] of the class template
|
|
@@ -387,26 +408,26 @@ template<class T> class X {
|
|
| 387 |
};
|
| 388 |
```
|
| 389 |
|
| 390 |
— *end example*]
|
| 391 |
|
| 392 |
-
The name of a
|
| 393 |
-
declaration whose locus is contained by the scope to which the
|
| 394 |
-
|
| 395 |
|
| 396 |
[*Example 5*:
|
| 397 |
|
| 398 |
``` cpp
|
| 399 |
template<class T, int i> class Y {
|
| 400 |
-
int T; // error: template
|
| 401 |
void f() {
|
| 402 |
-
char T; // error: template
|
| 403 |
}
|
| 404 |
friend void T(); // OK, no name bound
|
| 405 |
};
|
| 406 |
|
| 407 |
-
template<class X> class X; // error: hidden by template
|
| 408 |
```
|
| 409 |
|
| 410 |
— *end example*]
|
| 411 |
|
| 412 |
Unqualified name lookup considers the template parameter scope of a
|
|
@@ -515,25 +536,25 @@ A name or *template-id* refers to the *current instantiation* if it is
|
|
| 515 |
class template, the name of the class template followed by the
|
| 516 |
template argument list of its *template-head* [[temp.arg]] enclosed in
|
| 517 |
`<>` (or an equivalent template alias specialization),
|
| 518 |
- in the definition of a nested class of a class template, the name of
|
| 519 |
the nested class referenced as a member of the current instantiation,
|
| 520 |
-
or
|
| 521 |
- in the definition of a class template partial specialization or a
|
| 522 |
member of a class template partial specialization, the name of the
|
| 523 |
class template followed by a template argument list equivalent to that
|
| 524 |
of the partial specialization [[temp.spec.partial]] enclosed in `<>`
|
| 525 |
-
(or an equivalent template alias specialization)
|
|
|
|
|
|
|
| 526 |
|
| 527 |
A template argument that is equivalent to a template parameter can be
|
| 528 |
used in place of that template parameter in a reference to the current
|
| 529 |
-
instantiation.
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
template parameter if
|
| 535 |
|
| 536 |
- it has the same type as the template parameter (ignoring
|
| 537 |
cv-qualification) and
|
| 538 |
- its initializer consists of a single *identifier* that names the
|
| 539 |
template parameter or, recursively, such a variable.
|
|
@@ -645,11 +666,11 @@ A qualified name [[basic.lookup.qual]] is dependent if
|
|
| 645 |
- it is a *conversion-function-id* whose *conversion-type-id* is
|
| 646 |
dependent, or
|
| 647 |
- its lookup context is dependent and is not the current instantiation,
|
| 648 |
or
|
| 649 |
- its lookup context is the current instantiation and it is
|
| 650 |
-
`operator=`,[^
|
| 651 |
- its lookup context is the current instantiation and has at least one
|
| 652 |
dependent base class, and qualified name lookup for the name finds
|
| 653 |
nothing [[basic.lookup.qual]].
|
| 654 |
|
| 655 |
[*Example 4*:
|
|
@@ -693,11 +714,44 @@ struct C : A, T {
|
|
| 693 |
int g() { return m; } // finds A::m in the template definition context
|
| 694 |
};
|
| 695 |
|
| 696 |
template int C<B>::f(); // error: finds both A::m and B::m
|
| 697 |
template int C<B>::g(); // OK, transformation to class member access syntax
|
| 698 |
-
// does not occur in the template definition context; see~[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 699 |
```
|
| 700 |
|
| 701 |
— *end example*]
|
| 702 |
|
| 703 |
A type is dependent if it is
|
|
@@ -711,16 +765,21 @@ A type is dependent if it is
|
|
| 711 |
- an array type whose element type is dependent or whose bound (if any)
|
| 712 |
is value-dependent,
|
| 713 |
- a function type whose parameters include one or more function
|
| 714 |
parameter packs,
|
| 715 |
- a function type whose exception specification is value-dependent,
|
|
|
|
|
|
|
| 716 |
- denoted by a *simple-template-id* in which either the template name is
|
| 717 |
-
a template parameter or any of the template arguments is
|
| 718 |
-
|
| 719 |
-
|
| 720 |
- denoted by `decltype(`*expression*`)`, where *expression* is
|
| 721 |
-
type-dependent [[temp.dep.expr]]
|
|
|
|
|
|
|
|
|
|
| 722 |
|
| 723 |
[*Note 3*: Because typedefs do not introduce new types, but instead
|
| 724 |
simply refer to other types, a name that refers to a typedef that is a
|
| 725 |
member of the current instantiation is dependent only if the type
|
| 726 |
referred to is dependent. — *end note*]
|
|
@@ -736,29 +795,57 @@ dependent [[temp.dep.type]].
|
|
| 736 |
An *id-expression* is type-dependent if it is a *template-id* that is
|
| 737 |
not a concept-id and is dependent; or if its terminal name is
|
| 738 |
|
| 739 |
- associated by name lookup with one or more declarations declared with
|
| 740 |
a dependent type,
|
| 741 |
-
- associated by name lookup with a
|
| 742 |
-
|
| 743 |
-
[[dcl.spec.auto]],
|
| 744 |
- associated by name lookup with a variable declared with a type that
|
| 745 |
contains a placeholder type [[dcl.spec.auto]] where the initializer is
|
| 746 |
type-dependent,
|
| 747 |
- associated by name lookup with one or more declarations of member
|
| 748 |
functions of a class that is the current instantiation declared with a
|
| 749 |
return type that contains a placeholder type,
|
| 750 |
- associated by name lookup with a structured binding declaration
|
| 751 |
[[dcl.struct.bind]] whose *brace-or-equal-initializer* is
|
| 752 |
type-dependent,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 753 |
- associated by name lookup with an entity captured by copy
|
| 754 |
[[expr.prim.lambda.capture]] in a *lambda-expression* that has an
|
| 755 |
explicit object parameter whose type is dependent [[dcl.fct]],
|
| 756 |
- the *identifier* `__func__` [[dcl.fct.def.general]], where any
|
| 757 |
enclosing function is a template, a member of a class template, or a
|
| 758 |
generic lambda,
|
| 759 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 760 |
- dependent
|
| 761 |
|
| 762 |
or if it names a dependent member of the current instantiation that is a
|
| 763 |
static data member of type “array of unknown bound of `T`” for some `T`
|
| 764 |
[[temp.static]]. Expressions of the following forms are type-dependent
|
|
@@ -793,10 +880,12 @@ typeid '(' expression ')'
|
|
| 793 |
typeid '(' type-id ')'
|
| 794 |
'::'ₒₚₜ delete cast-expression
|
| 795 |
'::'ₒₚₜ delete '[' ']' cast-expression
|
| 796 |
throw assignment-expressionₒₚₜ
|
| 797 |
noexcept '(' expression ')'
|
|
|
|
|
|
|
| 798 |
```
|
| 799 |
|
| 800 |
[*Note 1*: For the standard library macro `offsetof`, see
|
| 801 |
[[support.types]]. — *end note*]
|
| 802 |
|
|
@@ -814,21 +903,30 @@ always dependent. — *end note*]
|
|
| 814 |
A *braced-init-list* is type-dependent if any element is type-dependent
|
| 815 |
or is a pack expansion.
|
| 816 |
|
| 817 |
A *fold-expression* is type-dependent.
|
| 818 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 819 |
#### Value-dependent expressions <a id="temp.dep.constexpr">[[temp.dep.constexpr]]</a>
|
| 820 |
|
| 821 |
Except as described below, an expression used in a context where a
|
| 822 |
constant expression is required is value-dependent if any subexpression
|
| 823 |
is value-dependent.
|
| 824 |
|
| 825 |
-
An *id-expression* is value-dependent if
|
| 826 |
|
| 827 |
-
- it is a concept-id and
|
|
|
|
| 828 |
- it is type-dependent,
|
| 829 |
-
- it is the name of a
|
|
|
|
|
|
|
| 830 |
- it names a static data member that is a dependent member of the
|
| 831 |
current instantiation and is not initialized in a *member-declarator*,
|
| 832 |
- it names a static member function that is a dependent member of the
|
| 833 |
current instantiation, or
|
| 834 |
- it names a potentially-constant variable [[expr.const]] that is
|
|
@@ -842,58 +940,158 @@ dependent:
|
|
| 842 |
sizeof unary-expression
|
| 843 |
sizeof '(' type-id ')'
|
| 844 |
typeid '(' expression ')'
|
| 845 |
typeid '(' type-id ')'
|
| 846 |
alignof '(' type-id ')'
|
| 847 |
-
noexcept '(' expression ')'
|
| 848 |
```
|
| 849 |
|
| 850 |
[*Note 1*: For the standard library macro `offsetof`, see
|
| 851 |
[[support.types]]. — *end note*]
|
| 852 |
|
| 853 |
Expressions of the following form are value-dependent if either the
|
| 854 |
-
*type-id*
|
| 855 |
-
*cast-expression* is value-dependent
|
|
|
|
|
|
|
| 856 |
|
| 857 |
``` bnf
|
| 858 |
simple-type-specifier '(' expression-listₒₚₜ ')'
|
|
|
|
|
|
|
|
|
|
| 859 |
static_cast '<' type-id '>' '(' expression ')'
|
| 860 |
const_cast '<' type-id '>' '(' expression ')'
|
| 861 |
reinterpret_cast '<' type-id '>' '(' expression ')'
|
|
|
|
| 862 |
'(' type-id ')' cast-expression
|
| 863 |
```
|
| 864 |
|
| 865 |
Expressions of the following form are value-dependent:
|
| 866 |
|
| 867 |
``` bnf
|
| 868 |
sizeof '...' '(' identifier ')'
|
| 869 |
fold-expression
|
| 870 |
```
|
| 871 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 872 |
An expression of the form `&`*qualified-id* where the *qualified-id*
|
| 873 |
names a dependent member of the current instantiation is
|
| 874 |
value-dependent. An expression of the form `&`*cast-expression* is also
|
| 875 |
value-dependent if evaluating *cast-expression* as a core constant
|
| 876 |
expression [[expr.const]] succeeds and the result of the evaluation
|
| 877 |
refers to a templated entity that is an object with static or thread
|
| 878 |
storage duration or a member function.
|
| 879 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 880 |
#### Dependent template arguments <a id="temp.dep.temp">[[temp.dep.temp]]</a>
|
| 881 |
|
| 882 |
A type *template-argument* is dependent if the type it specifies is
|
| 883 |
dependent.
|
| 884 |
|
| 885 |
-
A
|
| 886 |
the constant expression it specifies is value-dependent.
|
| 887 |
|
| 888 |
-
Furthermore, a
|
| 889 |
-
corresponding
|
| 890 |
type and the *template-argument* designates or points to a member of the
|
| 891 |
current instantiation or a member of a dependent type.
|
| 892 |
|
| 893 |
-
A template
|
| 894 |
-
|
|
|
|
|
|
|
| 895 |
|
| 896 |
### Dependent name resolution <a id="temp.dep.res">[[temp.dep.res]]</a>
|
| 897 |
|
| 898 |
#### Point of instantiation <a id="temp.point">[[temp.point]]</a>
|
| 899 |
|
|
@@ -963,10 +1161,16 @@ instantiation within a translation unit. A specialization for any
|
|
| 963 |
template may have points of instantiation in multiple translation units.
|
| 964 |
If two different points of instantiation give a template specialization
|
| 965 |
different meanings according to the one-definition rule
|
| 966 |
[[basic.def.odr]], the program is ill-formed, no diagnostic required.
|
| 967 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 968 |
#### Candidate functions <a id="temp.dep.candidate">[[temp.dep.candidate]]</a>
|
| 969 |
|
| 970 |
If a dependent call [[temp.dep]] would be ill-formed or would find a
|
| 971 |
better match had the lookup for its dependent name considered all the
|
| 972 |
function declarations with external linkage introduced in the associated
|
|
|
|
| 87 |
specialization, the program is ill-formed, no diagnostic required.
|
| 88 |
|
| 89 |
``` bnf
|
| 90 |
typename-specifier:
|
| 91 |
typename nested-name-specifier identifier
|
| 92 |
+
typename nested-name-specifier templateₒₚₜ simple-template-id
|
| 93 |
```
|
| 94 |
|
| 95 |
The component names of a *typename-specifier* are its *identifier* (if
|
| 96 |
any) and those of its *nested-name-specifier* and *simple-template-id*
|
| 97 |
(if any). A *typename-specifier* denotes the type or class template
|
|
|
|
| 122 |
}
|
| 123 |
```
|
| 124 |
|
| 125 |
— *end example*]
|
| 126 |
|
| 127 |
+
A *type-only context* is defined as follows: A qualified or unqualified
|
| 128 |
+
name is said to be in a type-only context if it is the terminal name of
|
| 129 |
|
| 130 |
+
- a *typename-specifier*, *type-requirement*, *nested-name-specifier*,
|
| 131 |
+
*elaborated-type-specifier*, *class-or-decltype*,
|
| 132 |
+
*using-enum-declarator*, or
|
| 133 |
+
- a *simple-type-specifier* of a *friend-type-specifier*, or
|
| 134 |
- a *type-specifier* of a
|
| 135 |
- *new-type-id*,
|
| 136 |
- *defining-type-id*,
|
| 137 |
- *conversion-type-id*,
|
| 138 |
- *trailing-return-type*,
|
| 139 |
- default argument of a *type-parameter*, or
|
| 140 |
- *type-id* of a `static_cast`, `const_cast`, `reinterpret_cast`, or
|
| 141 |
`dynamic_cast`, or
|
| 142 |
- a *decl-specifier* of the *decl-specifier-seq* of a
|
| 143 |
+
- *simple-declaration* or *function-definition* in namespace scope,
|
| 144 |
- *member-declaration*,
|
| 145 |
+
- *parameter-declaration* in a *member-declaration*,[^9] unless that
|
| 146 |
*parameter-declaration* appears in a default argument,
|
| 147 |
- *parameter-declaration* in a *declarator* of a function or function
|
| 148 |
template declaration whose *declarator-id* is qualified, unless that
|
| 149 |
*parameter-declaration* appears in a default argument,
|
| 150 |
- *parameter-declaration* in a *lambda-declarator* or
|
| 151 |
*requirement-parameter-list*, unless that *parameter-declaration*
|
| 152 |
appears in a default argument, or
|
| 153 |
+
- *parameter-declaration* of a *template-parameter* (which necessarily
|
| 154 |
+
declares a constant template parameter).
|
| 155 |
+
|
| 156 |
+
A *splice-specifier* or *splice-specialization-specifier*
|
| 157 |
+
[[basic.splice]] is said to be in a type-only context if a hypothetical
|
| 158 |
+
qualified name appearing in the same position would be in a type-only
|
| 159 |
+
context.
|
| 160 |
|
| 161 |
[*Example 5*:
|
| 162 |
|
| 163 |
``` cpp
|
| 164 |
template<class T> T::R f(); // OK, return type of a function declaration at global scope
|
| 165 |
template<class T> void f(T::R); // ill-formed, no diagnostic required: attempt to declare
|
| 166 |
// a void variable template
|
| 167 |
+
enum class Enum { A, B, C };
|
| 168 |
template<class T> struct S {
|
| 169 |
using Ptr = PtrTraits<T>::Ptr; // OK, in a defining-type-id
|
| 170 |
+
using Alias = [:^^int:]; // OK, in a defining-type-id
|
| 171 |
T::R f(T::P p) { // OK, class scope
|
| 172 |
return static_cast<T::R>(p); // OK, type-id of a static_cast
|
| 173 |
}
|
| 174 |
auto g() -> S<T*>::Ptr; // OK, trailing-return-type
|
| 175 |
+
auto h() -> [:^^S:]<T*>; // OK, trailing-return-type
|
| 176 |
+
using enum [:^^Enum:]; // OK, using-enum-declarator
|
| 177 |
};
|
| 178 |
template<typename T> void f() {
|
| 179 |
void (*pf)(T::X); // variable pf of type void* initialized with T::X
|
| 180 |
void g(T::X); // error: T::X at block scope does not denote a type
|
| 181 |
// (attempt to declare a void variable)
|
|
|
|
| 210 |
}
|
| 211 |
```
|
| 212 |
|
| 213 |
— *end example*]
|
| 214 |
|
| 215 |
+
The validity of a templated entity may be checked prior to any
|
| 216 |
+
instantiation.
|
| 217 |
|
| 218 |
[*Note 3*: Knowing which names are type names allows the syntax of
|
| 219 |
every template to be checked in this way. — *end note*]
|
| 220 |
|
| 221 |
+
The program is ill-formed, no diagnostic required, if
|
| 222 |
|
| 223 |
- no valid specialization, ignoring *static_assert-declaration*s that
|
| 224 |
+
fail [[dcl.pre]], can be generated for a templated entity or a
|
| 225 |
+
substatement of a constexpr if statement [[stmt.if]] within a
|
| 226 |
+
templated entity and the innermost enclosing template is not
|
| 227 |
instantiated, or
|
| 228 |
+
- no valid specialization, ignoring *static_assert-declaration*s that
|
| 229 |
+
fail, can be generated for the *compound-statement* of an
|
| 230 |
+
*expansion-statement* and there is no instantiation of it, or
|
| 231 |
+
- no valid specialization, ignoring *static_assert-declaration*s that
|
| 232 |
+
fail, can be generated for a default *template-argument* and the
|
| 233 |
+
default *template-argument* is not used in any instantiation, or
|
| 234 |
+
- no specialization of an alias template [[temp.alias]] is valid and no
|
| 235 |
+
specialization of the alias template is named in the program, or
|
| 236 |
- any *constraint-expression* in the program, introduced or otherwise,
|
| 237 |
has (in its normal form) an atomic constraint A where no satisfaction
|
| 238 |
check of A could be well-formed and no satisfaction check of A is
|
| 239 |
performed, or
|
| 240 |
- every valid specialization of a variadic template requires an empty
|
| 241 |
template parameter pack, or
|
| 242 |
+
- a hypothetical instantiation of a templated entity immediately
|
| 243 |
+
following its definition would be ill-formed due to a construct (other
|
| 244 |
+
than a *static_assert-declaration* that fails) that does not depend on
|
| 245 |
+
a template parameter, or
|
| 246 |
- the interpretation of such a construct in the hypothetical
|
| 247 |
instantiation is different from the interpretation of the
|
| 248 |
+
corresponding construct in any actual instantiation of the templated
|
| 249 |
+
entity.
|
| 250 |
|
| 251 |
[*Note 4*:
|
| 252 |
|
| 253 |
This can happen in situations including the following:
|
| 254 |
|
|
|
|
| 279 |
it names an explicit specialization that was not declared when the
|
| 280 |
template was defined.
|
| 281 |
|
| 282 |
— *end note*]
|
| 283 |
|
|
|
|
|
|
|
|
|
|
| 284 |
[*Note 5*: If a template is instantiated, errors will be diagnosed
|
| 285 |
according to the other rules in this document. Exactly when these errors
|
| 286 |
are diagnosed is a quality of implementation issue. — *end note*]
|
| 287 |
|
| 288 |
[*Example 7*:
|
|
|
|
| 319 |
### Locally declared names <a id="temp.local">[[temp.local]]</a>
|
| 320 |
|
| 321 |
Like normal (non-template) classes, class templates have an
|
| 322 |
injected-class-name [[class.pre]]. The injected-class-name can be used
|
| 323 |
as a *template-name* or a *type-name*. When it is used with a
|
| 324 |
+
*template-argument-list*, as a *template-argument* for a type template
|
| 325 |
+
template parameter, or as the final identifier in the
|
| 326 |
*elaborated-type-specifier* of a friend class template declaration, it
|
| 327 |
is a *template-name* that refers to the class template itself.
|
| 328 |
Otherwise, it is a *type-name* equivalent to the *template-name*
|
| 329 |
followed by the template argument list
|
| 330 |
[[temp.decls.general]], [[temp.arg.general]] of the class template
|
|
|
|
| 408 |
};
|
| 409 |
```
|
| 410 |
|
| 411 |
— *end example*]
|
| 412 |
|
| 413 |
+
The name of a template parameter shall not be bound to any following
|
| 414 |
+
declaration whose locus is contained by the scope to which the template
|
| 415 |
+
parameter belongs.
|
| 416 |
|
| 417 |
[*Example 5*:
|
| 418 |
|
| 419 |
``` cpp
|
| 420 |
template<class T, int i> class Y {
|
| 421 |
+
int T; // error: template parameter hidden
|
| 422 |
void f() {
|
| 423 |
+
char T; // error: template parameter hidden
|
| 424 |
}
|
| 425 |
friend void T(); // OK, no name bound
|
| 426 |
};
|
| 427 |
|
| 428 |
+
template<class X> class X; // error: hidden by template parameter
|
| 429 |
```
|
| 430 |
|
| 431 |
— *end example*]
|
| 432 |
|
| 433 |
Unqualified name lookup considers the template parameter scope of a
|
|
|
|
| 536 |
class template, the name of the class template followed by the
|
| 537 |
template argument list of its *template-head* [[temp.arg]] enclosed in
|
| 538 |
`<>` (or an equivalent template alias specialization),
|
| 539 |
- in the definition of a nested class of a class template, the name of
|
| 540 |
the nested class referenced as a member of the current instantiation,
|
|
|
|
| 541 |
- in the definition of a class template partial specialization or a
|
| 542 |
member of a class template partial specialization, the name of the
|
| 543 |
class template followed by a template argument list equivalent to that
|
| 544 |
of the partial specialization [[temp.spec.partial]] enclosed in `<>`
|
| 545 |
+
(or an equivalent template alias specialization), or
|
| 546 |
+
- in the definition of a templated function, the name of a local class
|
| 547 |
+
[[class.local]].
|
| 548 |
|
| 549 |
A template argument that is equivalent to a template parameter can be
|
| 550 |
used in place of that template parameter in a reference to the current
|
| 551 |
+
instantiation. A template argument is equivalent to a type template
|
| 552 |
+
parameter if it denotes the same type. A template argument is equivalent
|
| 553 |
+
to a constant template parameter if it is an *identifier* that names a
|
| 554 |
+
variable that is equivalent to the template parameter. A variable is
|
| 555 |
+
equivalent to a template parameter if
|
|
|
|
| 556 |
|
| 557 |
- it has the same type as the template parameter (ignoring
|
| 558 |
cv-qualification) and
|
| 559 |
- its initializer consists of a single *identifier* that names the
|
| 560 |
template parameter or, recursively, such a variable.
|
|
|
|
| 666 |
- it is a *conversion-function-id* whose *conversion-type-id* is
|
| 667 |
dependent, or
|
| 668 |
- its lookup context is dependent and is not the current instantiation,
|
| 669 |
or
|
| 670 |
- its lookup context is the current instantiation and it is
|
| 671 |
+
`operator=`,[^10] or
|
| 672 |
- its lookup context is the current instantiation and has at least one
|
| 673 |
dependent base class, and qualified name lookup for the name finds
|
| 674 |
nothing [[basic.lookup.qual]].
|
| 675 |
|
| 676 |
[*Example 4*:
|
|
|
|
| 714 |
int g() { return m; } // finds A::m in the template definition context
|
| 715 |
};
|
| 716 |
|
| 717 |
template int C<B>::f(); // error: finds both A::m and B::m
|
| 718 |
template int C<B>::g(); // OK, transformation to class member access syntax
|
| 719 |
+
// does not occur in the template definition context; see~[expr.prim.id.general]
|
| 720 |
+
```
|
| 721 |
+
|
| 722 |
+
— *end example*]
|
| 723 |
+
|
| 724 |
+
An initializer is dependent if any constituent expression
|
| 725 |
+
[[intro.execution]] of the initializer is type-dependent. A placeholder
|
| 726 |
+
type [[dcl.spec.auto.general]] is dependent if it designates a type
|
| 727 |
+
deduced from a dependent initializer.
|
| 728 |
+
|
| 729 |
+
A placeholder for a deduced class type [[dcl.type.class.deduct]] is
|
| 730 |
+
dependent if
|
| 731 |
+
|
| 732 |
+
- it has a dependent initializer, or
|
| 733 |
+
- it refers to an alias template that is a member of the current
|
| 734 |
+
instantiation and whose *defining-type-id* is dependent after class
|
| 735 |
+
template argument deduction [[over.match.class.deduct]] and
|
| 736 |
+
substitution [[temp.alias]].
|
| 737 |
+
|
| 738 |
+
[*Example 6*:
|
| 739 |
+
|
| 740 |
+
``` cpp
|
| 741 |
+
template<class T, class V>
|
| 742 |
+
struct S { S(T); };
|
| 743 |
+
|
| 744 |
+
template<class U>
|
| 745 |
+
struct A {
|
| 746 |
+
template<class T> using X = S<T, U>;
|
| 747 |
+
template<class T> using Y = S<T, int>;
|
| 748 |
+
void f() {
|
| 749 |
+
new X(1); // dependent
|
| 750 |
+
new Y(1); // not dependent
|
| 751 |
+
}
|
| 752 |
+
};
|
| 753 |
```
|
| 754 |
|
| 755 |
— *end example*]
|
| 756 |
|
| 757 |
A type is dependent if it is
|
|
|
|
| 765 |
- an array type whose element type is dependent or whose bound (if any)
|
| 766 |
is value-dependent,
|
| 767 |
- a function type whose parameters include one or more function
|
| 768 |
parameter packs,
|
| 769 |
- a function type whose exception specification is value-dependent,
|
| 770 |
+
- denoted by a dependent placeholder type,
|
| 771 |
+
- denoted by a dependent placeholder for a deduced class type,
|
| 772 |
- denoted by a *simple-template-id* in which either the template name is
|
| 773 |
+
a template parameter or any of the template arguments is dependent
|
| 774 |
+
[[temp.dep.temp]],[^11]
|
| 775 |
+
- a *pack-index-specifier*,
|
| 776 |
- denoted by `decltype(`*expression*`)`, where *expression* is
|
| 777 |
+
type-dependent [[temp.dep.expr]], or
|
| 778 |
+
- denoted by a *splice-type-specifier* in which either the
|
| 779 |
+
*splice-specifier* or *splice-specialization-specifier* is dependent
|
| 780 |
+
[[temp.dep.splice]].
|
| 781 |
|
| 782 |
[*Note 3*: Because typedefs do not introduce new types, but instead
|
| 783 |
simply refer to other types, a name that refers to a typedef that is a
|
| 784 |
member of the current instantiation is dependent only if the type
|
| 785 |
referred to is dependent. — *end note*]
|
|
|
|
| 795 |
An *id-expression* is type-dependent if it is a *template-id* that is
|
| 796 |
not a concept-id and is dependent; or if its terminal name is
|
| 797 |
|
| 798 |
- associated by name lookup with one or more declarations declared with
|
| 799 |
a dependent type,
|
| 800 |
+
- associated by name lookup with a constant template parameter declared
|
| 801 |
+
with a type that contains a placeholder type [[dcl.spec.auto]],
|
|
|
|
| 802 |
- associated by name lookup with a variable declared with a type that
|
| 803 |
contains a placeholder type [[dcl.spec.auto]] where the initializer is
|
| 804 |
type-dependent,
|
| 805 |
- associated by name lookup with one or more declarations of member
|
| 806 |
functions of a class that is the current instantiation declared with a
|
| 807 |
return type that contains a placeholder type,
|
| 808 |
- associated by name lookup with a structured binding declaration
|
| 809 |
[[dcl.struct.bind]] whose *brace-or-equal-initializer* is
|
| 810 |
type-dependent,
|
| 811 |
+
- associated by name lookup with a pack,
|
| 812 |
+
\[*Example 1*:
|
| 813 |
+
``` cpp
|
| 814 |
+
struct C { };
|
| 815 |
+
|
| 816 |
+
void g(...); // #1
|
| 817 |
+
|
| 818 |
+
template <typename T>
|
| 819 |
+
void f() {
|
| 820 |
+
C arr[1];
|
| 821 |
+
auto [...e] = arr;
|
| 822 |
+
g(e...); // calls #2
|
| 823 |
+
}
|
| 824 |
+
|
| 825 |
+
void g(C); // #2
|
| 826 |
+
|
| 827 |
+
int main() {
|
| 828 |
+
f<int>();
|
| 829 |
+
}
|
| 830 |
+
```
|
| 831 |
+
|
| 832 |
+
— *end example*]
|
| 833 |
- associated by name lookup with an entity captured by copy
|
| 834 |
[[expr.prim.lambda.capture]] in a *lambda-expression* that has an
|
| 835 |
explicit object parameter whose type is dependent [[dcl.fct]],
|
| 836 |
- the *identifier* `__func__` [[dcl.fct.def.general]], where any
|
| 837 |
enclosing function is a template, a member of a class template, or a
|
| 838 |
generic lambda,
|
| 839 |
+
- associated by name lookup with a result binding [[dcl.contract.res]]
|
| 840 |
+
of a function whose return type is dependent,
|
| 841 |
+
- a *conversion-function-id* that specifies a dependent type,
|
| 842 |
+
- a name N introduced by the *for-range-declaration* of an
|
| 843 |
+
*expansion-statement* S if the type specified for N contains a
|
| 844 |
+
placeholder type and either
|
| 845 |
+
- the *expansion-initializer* of S is type-dependent or
|
| 846 |
+
- S is not an iterating expansion statement, or
|
| 847 |
- dependent
|
| 848 |
|
| 849 |
or if it names a dependent member of the current instantiation that is a
|
| 850 |
static data member of type “array of unknown bound of `T`” for some `T`
|
| 851 |
[[temp.static]]. Expressions of the following forms are type-dependent
|
|
|
|
| 880 |
typeid '(' type-id ')'
|
| 881 |
'::'ₒₚₜ delete cast-expression
|
| 882 |
'::'ₒₚₜ delete '[' ']' cast-expression
|
| 883 |
throw assignment-expressionₒₚₜ
|
| 884 |
noexcept '(' expression ')'
|
| 885 |
+
requires-expression
|
| 886 |
+
reflect-expression
|
| 887 |
```
|
| 888 |
|
| 889 |
[*Note 1*: For the standard library macro `offsetof`, see
|
| 890 |
[[support.types]]. — *end note*]
|
| 891 |
|
|
|
|
| 903 |
A *braced-init-list* is type-dependent if any element is type-dependent
|
| 904 |
or is a pack expansion.
|
| 905 |
|
| 906 |
A *fold-expression* is type-dependent.
|
| 907 |
|
| 908 |
+
A *pack-index-expression* is type-dependent if its *id-expression* is
|
| 909 |
+
type-dependent.
|
| 910 |
+
|
| 911 |
+
A *splice-expression* is type-dependent if its *splice-specifier* or
|
| 912 |
+
*splice-specialization-specifier* is dependent [[temp.dep.splice]].
|
| 913 |
+
|
| 914 |
#### Value-dependent expressions <a id="temp.dep.constexpr">[[temp.dep.constexpr]]</a>
|
| 915 |
|
| 916 |
Except as described below, an expression used in a context where a
|
| 917 |
constant expression is required is value-dependent if any subexpression
|
| 918 |
is value-dependent.
|
| 919 |
|
| 920 |
+
An *id-expression* is value-dependent if
|
| 921 |
|
| 922 |
+
- it is a concept-id and its *concept-name* is dependent or any of its
|
| 923 |
+
arguments are dependent [[temp.dep.temp]],
|
| 924 |
- it is type-dependent,
|
| 925 |
+
- it is the name of a constant template parameter,
|
| 926 |
+
- it is a name introduced by the *for-range-declaration* of an
|
| 927 |
+
*expansion-statement* [[stmt.expand]],
|
| 928 |
- it names a static data member that is a dependent member of the
|
| 929 |
current instantiation and is not initialized in a *member-declarator*,
|
| 930 |
- it names a static member function that is a dependent member of the
|
| 931 |
current instantiation, or
|
| 932 |
- it names a potentially-constant variable [[expr.const]] that is
|
|
|
|
| 940 |
sizeof unary-expression
|
| 941 |
sizeof '(' type-id ')'
|
| 942 |
typeid '(' expression ')'
|
| 943 |
typeid '(' type-id ')'
|
| 944 |
alignof '(' type-id ')'
|
|
|
|
| 945 |
```
|
| 946 |
|
| 947 |
[*Note 1*: For the standard library macro `offsetof`, see
|
| 948 |
[[support.types]]. — *end note*]
|
| 949 |
|
| 950 |
Expressions of the following form are value-dependent if either the
|
| 951 |
+
*type-id*, *simple-type-specifier*, or *typename-specifier* is dependent
|
| 952 |
+
or the *expression* or *cast-expression* is value-dependent or any
|
| 953 |
+
*expression* in the *expression-list* is value-dependent or any
|
| 954 |
+
*assignment-expression* in the *braced-init-list* is value-dependent:
|
| 955 |
|
| 956 |
``` bnf
|
| 957 |
simple-type-specifier '(' expression-listₒₚₜ ')'
|
| 958 |
+
typename-specifier '(' expression-listₒₚₜ ')'
|
| 959 |
+
simple-type-specifier braced-init-list
|
| 960 |
+
typename-specifier braced-init-list
|
| 961 |
static_cast '<' type-id '>' '(' expression ')'
|
| 962 |
const_cast '<' type-id '>' '(' expression ')'
|
| 963 |
reinterpret_cast '<' type-id '>' '(' expression ')'
|
| 964 |
+
dynamic_cast '<' type-id '>' '(' expression ')'
|
| 965 |
'(' type-id ')' cast-expression
|
| 966 |
```
|
| 967 |
|
| 968 |
Expressions of the following form are value-dependent:
|
| 969 |
|
| 970 |
``` bnf
|
| 971 |
sizeof '...' '(' identifier ')'
|
| 972 |
fold-expression
|
| 973 |
```
|
| 974 |
|
| 975 |
+
unless the *identifier* is a structured binding pack whose initializer
|
| 976 |
+
is not dependent.
|
| 977 |
+
|
| 978 |
+
A *noexcept-expression* [[expr.unary.noexcept]] is value-dependent if
|
| 979 |
+
its *expression* involves a template parameter.
|
| 980 |
+
|
| 981 |
An expression of the form `&`*qualified-id* where the *qualified-id*
|
| 982 |
names a dependent member of the current instantiation is
|
| 983 |
value-dependent. An expression of the form `&`*cast-expression* is also
|
| 984 |
value-dependent if evaluating *cast-expression* as a core constant
|
| 985 |
expression [[expr.const]] succeeds and the result of the evaluation
|
| 986 |
refers to a templated entity that is an object with static or thread
|
| 987 |
storage duration or a member function.
|
| 988 |
|
| 989 |
+
A *reflect-expression* is value-dependent if
|
| 990 |
+
|
| 991 |
+
- it is of the form `^^ reflection-name` and the *reflection-name*
|
| 992 |
+
- is a dependent qualified name,
|
| 993 |
+
- is a dependent *namespace-name*,
|
| 994 |
+
- is the name of a template parameter, or
|
| 995 |
+
- names a dependent member of the current instantiation
|
| 996 |
+
[[temp.dep.type]],
|
| 997 |
+
- it is of the form `^^ type-id` and the *type-id* denotes a dependent
|
| 998 |
+
type, or
|
| 999 |
+
- it is of the form `^^ id-expression` and the *id-expression* is
|
| 1000 |
+
value-dependent.
|
| 1001 |
+
|
| 1002 |
+
A *splice-expression* is value-dependent if its *splice-specifier* or
|
| 1003 |
+
*splice-specialization-specifier* is dependent [[temp.dep.splice]].
|
| 1004 |
+
|
| 1005 |
+
#### Dependent splice specifiers <a id="temp.dep.splice">[[temp.dep.splice]]</a>
|
| 1006 |
+
|
| 1007 |
+
A *splice-specifier* is dependent if its converted *constant-expression*
|
| 1008 |
+
is value-dependent. A *splice-specialization-specifier* is dependent if
|
| 1009 |
+
its *splice-specifier* is dependent or if any of its template arguments
|
| 1010 |
+
are dependent. A *splice-scope-specifier* is dependent if its
|
| 1011 |
+
*splice-specifier* or *splice-specialization-specifier* is dependent.
|
| 1012 |
+
|
| 1013 |
+
[*Example 1*:
|
| 1014 |
+
|
| 1015 |
+
``` cpp
|
| 1016 |
+
template<auto T, auto NS>
|
| 1017 |
+
void fn() {
|
| 1018 |
+
using a = [:T:]<1>; // [:T:]<1> is dependent because [:T:] is dependent
|
| 1019 |
+
static_assert([:NS:]::template TCls<1>::v == a::v); // [:NS:] is dependent
|
| 1020 |
+
}
|
| 1021 |
+
|
| 1022 |
+
namespace N {
|
| 1023 |
+
template <auto V> struct TCls { static constexpr int v = V; };
|
| 1024 |
+
}
|
| 1025 |
+
|
| 1026 |
+
int main() {
|
| 1027 |
+
fn<^^N::TCls, ^^N>();
|
| 1028 |
+
}
|
| 1029 |
+
```
|
| 1030 |
+
|
| 1031 |
+
— *end example*]
|
| 1032 |
+
|
| 1033 |
+
[*Example 2*:
|
| 1034 |
+
|
| 1035 |
+
``` cpp
|
| 1036 |
+
template<template<class> class X>
|
| 1037 |
+
struct S {
|
| 1038 |
+
[:^^X:]<int, float> m;
|
| 1039 |
+
};
|
| 1040 |
+
|
| 1041 |
+
template<class> struct V1 {};
|
| 1042 |
+
template<class, class = int> struct V2 {};
|
| 1043 |
+
|
| 1044 |
+
S<V1> s1; // error: V1<int, float> has too many template arguments
|
| 1045 |
+
S<V2> s2; // OK
|
| 1046 |
+
```
|
| 1047 |
+
|
| 1048 |
+
— *end example*]
|
| 1049 |
+
|
| 1050 |
+
#### Dependent namespaces <a id="temp.dep.namespace">[[temp.dep.namespace]]</a>
|
| 1051 |
+
|
| 1052 |
+
A namespace alias is dependent if it is introduced by a
|
| 1053 |
+
*namespace-alias-definition* whose *qualified-namespace-specifier* (if
|
| 1054 |
+
any) is a dependent qualified name or whose *splice-specifier* (if any)
|
| 1055 |
+
is dependent. A *namespace-name* is dependent if it names a dependent
|
| 1056 |
+
namespace alias.
|
| 1057 |
+
|
| 1058 |
+
[*Example 1*:
|
| 1059 |
+
|
| 1060 |
+
``` cpp
|
| 1061 |
+
template<std::meta::info R>
|
| 1062 |
+
int fn() {
|
| 1063 |
+
namespace Alias = [:R:]; // [:R:] is dependent
|
| 1064 |
+
return typename Alias::T{}; // Alias is dependent
|
| 1065 |
+
}
|
| 1066 |
+
|
| 1067 |
+
namespace NS {
|
| 1068 |
+
using T = int;
|
| 1069 |
+
}
|
| 1070 |
+
|
| 1071 |
+
int a = fn<^^NS>();
|
| 1072 |
+
```
|
| 1073 |
+
|
| 1074 |
+
— *end example*]
|
| 1075 |
+
|
| 1076 |
#### Dependent template arguments <a id="temp.dep.temp">[[temp.dep.temp]]</a>
|
| 1077 |
|
| 1078 |
A type *template-argument* is dependent if the type it specifies is
|
| 1079 |
dependent.
|
| 1080 |
|
| 1081 |
+
A constant *template-argument* is dependent if its type is dependent or
|
| 1082 |
the constant expression it specifies is value-dependent.
|
| 1083 |
|
| 1084 |
+
Furthermore, a constant *template-argument* is dependent if the
|
| 1085 |
+
corresponding constant template parameter is of reference or pointer
|
| 1086 |
type and the *template-argument* designates or points to a member of the
|
| 1087 |
current instantiation or a member of a dependent type.
|
| 1088 |
|
| 1089 |
+
A template argument is also dependent if it is a pack expansion.
|
| 1090 |
+
|
| 1091 |
+
A template template parameter is dependent if it names a template
|
| 1092 |
+
parameter or its terminal name is dependent.
|
| 1093 |
|
| 1094 |
### Dependent name resolution <a id="temp.dep.res">[[temp.dep.res]]</a>
|
| 1095 |
|
| 1096 |
#### Point of instantiation <a id="temp.point">[[temp.point]]</a>
|
| 1097 |
|
|
|
|
| 1161 |
template may have points of instantiation in multiple translation units.
|
| 1162 |
If two different points of instantiation give a template specialization
|
| 1163 |
different meanings according to the one-definition rule
|
| 1164 |
[[basic.def.odr]], the program is ill-formed, no diagnostic required.
|
| 1165 |
|
| 1166 |
+
For the *compound-statement* of an *expansion-statement*
|
| 1167 |
+
[[stmt.expand]], the point of instantiation is the point of
|
| 1168 |
+
instantiation of its enclosing templated entity, if any. Otherwise, it
|
| 1169 |
+
immediately follows the namespace-scope declaration or definition that
|
| 1170 |
+
contains the expansion statement.
|
| 1171 |
+
|
| 1172 |
#### Candidate functions <a id="temp.dep.candidate">[[temp.dep.candidate]]</a>
|
| 1173 |
|
| 1174 |
If a dependent call [[temp.dep]] would be ill-formed or would find a
|
| 1175 |
better match had the lookup for its dependent name considered all the
|
| 1176 |
function declarations with external linkage introduced in the associated
|