- tmp/tmpozunzdzd/{from.md → to.md} +157 -84
tmp/tmpozunzdzd/{from.md → to.md}
RENAMED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
### Names <a id="expr.prim.id">[[expr.prim.id]]</a>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
``` bnf
|
| 4 |
id-expression:
|
| 5 |
unqualified-id
|
| 6 |
qualified-id
|
| 7 |
```
|
|
@@ -9,63 +11,71 @@ id-expression:
|
|
| 9 |
An *id-expression* is a restricted form of a *primary-expression*.
|
| 10 |
|
| 11 |
[*Note 1*: An *id-expression* can appear after `.` and `->` operators
|
| 12 |
[[expr.ref]]. — *end note*]
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
- as part of a class member access [[expr.ref]] in which the object
|
| 18 |
expression refers to the member’s class[^10] or a class derived from
|
| 19 |
that class, or
|
| 20 |
- to form a pointer to member [[expr.unary.op]], or
|
| 21 |
- if that *id-expression* denotes a non-static data member and it
|
| 22 |
appears in an unevaluated operand.
|
| 23 |
-
\[*Example
|
| 24 |
``` cpp
|
| 25 |
struct S {
|
| 26 |
int m;
|
| 27 |
};
|
| 28 |
int i = sizeof(S::m); // OK
|
| 29 |
int j = sizeof(S::m + 42); // OK
|
| 30 |
```
|
| 31 |
|
| 32 |
— *end example*]
|
| 33 |
|
| 34 |
-
A potentially-evaluated *id-expression* that denotes an immediate
|
| 35 |
-
function [[dcl.constexpr]] shall appear only
|
| 36 |
-
|
| 37 |
-
- as a subexpression of an immediate invocation, or
|
| 38 |
-
- in an immediate function context [[expr.const]].
|
| 39 |
-
|
| 40 |
For an *id-expression* that denotes an overload set, overload resolution
|
| 41 |
-
is performed to select a unique function
|
| 42 |
-
[[over.over]]).
|
| 43 |
|
| 44 |
-
[*Note
|
| 45 |
|
| 46 |
A program cannot refer to a function with a trailing *requires-clause*
|
| 47 |
whose *constraint-expression* is not satisfied, because such functions
|
| 48 |
are never selected by overload resolution.
|
| 49 |
|
| 50 |
-
[*Example
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
template<typename T> struct A {
|
| 54 |
static void f(int) requires false;
|
| 55 |
-
}
|
| 56 |
|
| 57 |
void g() {
|
| 58 |
A<int>::f(0); // error: cannot call f
|
| 59 |
void (*p1)(int) = A<int>::f; // error: cannot take the address of f
|
| 60 |
decltype(A<int>::f)* p2 = nullptr; // error: the type decltype(A<int>::f) is invalid
|
| 61 |
}
|
| 62 |
```
|
| 63 |
|
| 64 |
In each case, the constraints of `f` are not satisfied. In the
|
| 65 |
declaration of `p2`, those constraints are required to be satisfied even
|
| 66 |
-
though `f` is an unevaluated operand [[
|
| 67 |
|
| 68 |
— *end example*]
|
| 69 |
|
| 70 |
— *end note*]
|
| 71 |
|
|
@@ -92,56 +102,109 @@ the copy of the parameter [[dcl.fct.def.coroutine]].
|
|
| 92 |
*literal-operator-id*s, see [[over.literal]]; for *template-id*s, see
|
| 93 |
[[temp.names]]. A *type-name* or *decltype-specifier* prefixed by `~`
|
| 94 |
denotes the destructor of the type so named; see [[expr.prim.id.dtor]].
|
| 95 |
Within the definition of a non-static member function, an *identifier*
|
| 96 |
that names a non-static member is transformed to a class member access
|
| 97 |
-
expression
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
type of such an identifier will typically be `const`
|
| 110 |
qualified. — *end note*]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
[*Note 3*: If the entity is a template parameter object for a template
|
| 115 |
parameter of type `T` [[temp.param]], the type of the expression is
|
| 116 |
`const T`. — *end note*]
|
| 117 |
|
| 118 |
-
[*Note
|
| 119 |
it is cv-qualified or is a reference type. — *end note*]
|
| 120 |
|
| 121 |
-
The expression is an
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
| 125 |
|
| 126 |
[*Example 1*:
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
void f() {
|
| 130 |
float x, &r = x;
|
| 131 |
-
|
|
|
|
|
|
|
| 132 |
decltype(x) y1; // y1 has type float
|
| 133 |
-
decltype((x)) y2 = y1; // y2 has type float const&
|
| 134 |
-
// is not mutable and x is an lvalue
|
| 135 |
decltype(r) r1 = y1; // r1 has type float&
|
| 136 |
decltype((r)) r2 = y2; // r2 has type float const&
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
};
|
| 138 |
}
|
| 139 |
```
|
| 140 |
|
| 141 |
— *end example*]
|
| 142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
#### Qualified names <a id="expr.prim.id.qual">[[expr.prim.id.qual]]</a>
|
| 144 |
|
| 145 |
``` bnf
|
| 146 |
qualified-id:
|
| 147 |
nested-name-specifier templateₒₚₜ unqualified-id
|
|
@@ -155,56 +218,66 @@ nested-name-specifier:
|
|
| 155 |
decltype-specifier '::'
|
| 156 |
nested-name-specifier identifier '::'
|
| 157 |
nested-name-specifier templateₒₚₜ simple-template-id '::'
|
| 158 |
```
|
| 159 |
|
| 160 |
-
The
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
and a prvalue otherwise.
|
| 171 |
|
| 172 |
-
[*Note 1*: A class member can be referred to using a *qualified-id* at
|
| 173 |
-
any point in its potential scope [[basic.scope.class]]. — *end note*]
|
| 174 |
-
|
| 175 |
-
Where *type-name* `::~` *type-name* is used, the two *type-name*s shall
|
| 176 |
-
refer to the same type (ignoring cv-qualifications); this notation
|
| 177 |
-
denotes the destructor of the type so named [[expr.prim.id.dtor]]. The
|
| 178 |
-
*unqualified-id* in a *qualified-id* shall not be of the form
|
| 179 |
-
`~`*decltype-specifier*.
|
| 180 |
-
|
| 181 |
-
The *nested-name-specifier* `::` names the global namespace. A
|
| 182 |
-
*nested-name-specifier* that names a namespace [[basic.namespace]],
|
| 183 |
-
optionally followed by the keyword `template` [[temp.names]], and then
|
| 184 |
-
followed by the name of a member of that namespace (or the name of a
|
| 185 |
-
member of a namespace made visible by a *using-directive*), is a
|
| 186 |
-
*qualified-id*; [[namespace.qual]] describes name lookup for namespace
|
| 187 |
-
members that appear in *qualified-id*s. The result is the member. The
|
| 188 |
-
type of the result is the type of the member. The result is an lvalue if
|
| 189 |
-
the member is a function, a variable, or a structured binding
|
| 190 |
-
[[dcl.struct.bind]] and a prvalue otherwise.
|
| 191 |
-
|
| 192 |
-
A *nested-name-specifier* that denotes an enumeration [[dcl.enum]],
|
| 193 |
-
followed by the name of an enumerator of that enumeration, is a
|
| 194 |
-
*qualified-id* that refers to the enumerator. The result is the
|
| 195 |
-
enumerator. The type of the result is the type of the enumeration. The
|
| 196 |
-
result is a prvalue.
|
| 197 |
-
|
| 198 |
-
In a *qualified-id*, if the *unqualified-id* is a
|
| 199 |
-
*conversion-function-id*, its *conversion-type-id* is first looked up in
|
| 200 |
-
the class denoted by the *nested-name-specifier* of the *qualified-id*
|
| 201 |
-
and the name, if found, is used. Otherwise, it is looked up in the
|
| 202 |
-
context in which the entire *qualified-id* occurs. In each of these
|
| 203 |
-
lookups, only names that denote types or templates whose specializations
|
| 204 |
-
are types are considered.
|
| 205 |
-
|
| 206 |
#### Destruction <a id="expr.prim.id.dtor">[[expr.prim.id.dtor]]</a>
|
| 207 |
|
| 208 |
An *id-expression* that denotes the destructor of a type `T` names the
|
| 209 |
destructor of `T` if `T` is a class type [[class.dtor]], otherwise the
|
| 210 |
*id-expression* is said to name a *pseudo-destructor*.
|
|
@@ -212,12 +285,12 @@ destructor of `T` if `T` is a class type [[class.dtor]], otherwise the
|
|
| 212 |
If the *id-expression* names a pseudo-destructor, `T` shall be a scalar
|
| 213 |
type and the *id-expression* shall appear as the right operand of a
|
| 214 |
class member access [[expr.ref]] that forms the *postfix-expression* of
|
| 215 |
a function call [[expr.call]].
|
| 216 |
|
| 217 |
-
[*Note 1*: Such a call ends the lifetime of the object
|
| 218 |
-
[[basic.life]]
|
| 219 |
|
| 220 |
[*Example 1*:
|
| 221 |
|
| 222 |
``` cpp
|
| 223 |
struct C { };
|
|
|
|
| 1 |
### Names <a id="expr.prim.id">[[expr.prim.id]]</a>
|
| 2 |
|
| 3 |
+
#### General <a id="expr.prim.id.general">[[expr.prim.id.general]]</a>
|
| 4 |
+
|
| 5 |
``` bnf
|
| 6 |
id-expression:
|
| 7 |
unqualified-id
|
| 8 |
qualified-id
|
| 9 |
```
|
|
|
|
| 11 |
An *id-expression* is a restricted form of a *primary-expression*.
|
| 12 |
|
| 13 |
[*Note 1*: An *id-expression* can appear after `.` and `->` operators
|
| 14 |
[[expr.ref]]. — *end note*]
|
| 15 |
|
| 16 |
+
If an *id-expression* E denotes a member M of an anonymous union
|
| 17 |
+
[[class.union.anon]] U:
|
| 18 |
+
|
| 19 |
+
- If U is a non-static data member, E refers to M as a member of the
|
| 20 |
+
lookup context of the terminal name of E (after any transformation to
|
| 21 |
+
a class member access expression [[class.mfct.non.static]]).
|
| 22 |
+
\[*Example 1*: `o.x` is interpreted as `o.u.x`, where u names the
|
| 23 |
+
anonymous union member. — *end example*]
|
| 24 |
+
- Otherwise, E is interpreted as a class member access [[expr.ref]] that
|
| 25 |
+
designates the member subobject M of the anonymous union variable for
|
| 26 |
+
U. \[*Note 2*: Under this interpretation, E no longer denotes a
|
| 27 |
+
non-static data member. — *end note*] \[*Example 2*: `N::x` is
|
| 28 |
+
interpreted as `N::u.x`, where u names the anonymous union
|
| 29 |
+
variable. — *end example*]
|
| 30 |
+
|
| 31 |
+
An *id-expression* that denotes a non-static data member or implicit
|
| 32 |
+
object member function of a class can only be used:
|
| 33 |
|
| 34 |
- as part of a class member access [[expr.ref]] in which the object
|
| 35 |
expression refers to the member’s class[^10] or a class derived from
|
| 36 |
that class, or
|
| 37 |
- to form a pointer to member [[expr.unary.op]], or
|
| 38 |
- if that *id-expression* denotes a non-static data member and it
|
| 39 |
appears in an unevaluated operand.
|
| 40 |
+
\[*Example 3*:
|
| 41 |
``` cpp
|
| 42 |
struct S {
|
| 43 |
int m;
|
| 44 |
};
|
| 45 |
int i = sizeof(S::m); // OK
|
| 46 |
int j = sizeof(S::m + 42); // OK
|
| 47 |
```
|
| 48 |
|
| 49 |
— *end example*]
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
For an *id-expression* that denotes an overload set, overload resolution
|
| 52 |
+
is performed to select a unique function [[over.match]], [[over.over]].
|
|
|
|
| 53 |
|
| 54 |
+
[*Note 3*:
|
| 55 |
|
| 56 |
A program cannot refer to a function with a trailing *requires-clause*
|
| 57 |
whose *constraint-expression* is not satisfied, because such functions
|
| 58 |
are never selected by overload resolution.
|
| 59 |
|
| 60 |
+
[*Example 4*:
|
| 61 |
|
| 62 |
``` cpp
|
| 63 |
template<typename T> struct A {
|
| 64 |
static void f(int) requires false;
|
| 65 |
+
};
|
| 66 |
|
| 67 |
void g() {
|
| 68 |
A<int>::f(0); // error: cannot call f
|
| 69 |
void (*p1)(int) = A<int>::f; // error: cannot take the address of f
|
| 70 |
decltype(A<int>::f)* p2 = nullptr; // error: the type decltype(A<int>::f) is invalid
|
| 71 |
}
|
| 72 |
```
|
| 73 |
|
| 74 |
In each case, the constraints of `f` are not satisfied. In the
|
| 75 |
declaration of `p2`, those constraints are required to be satisfied even
|
| 76 |
+
though `f` is an unevaluated operand [[term.unevaluated.operand]].
|
| 77 |
|
| 78 |
— *end example*]
|
| 79 |
|
| 80 |
— *end note*]
|
| 81 |
|
|
|
|
| 102 |
*literal-operator-id*s, see [[over.literal]]; for *template-id*s, see
|
| 103 |
[[temp.names]]. A *type-name* or *decltype-specifier* prefixed by `~`
|
| 104 |
denotes the destructor of the type so named; see [[expr.prim.id.dtor]].
|
| 105 |
Within the definition of a non-static member function, an *identifier*
|
| 106 |
that names a non-static member is transformed to a class member access
|
| 107 |
+
expression [[class.mfct.non.static]]. — *end note*]
|
| 108 |
+
|
| 109 |
+
A *component name* of an *unqualified-id* U is
|
| 110 |
+
|
| 111 |
+
- U if it is a name or
|
| 112 |
+
- the component name of the *template-id* or *type-name* of U, if any.
|
| 113 |
+
|
| 114 |
+
[*Note 2*: Other constructs that contain names to look up can have
|
| 115 |
+
several component names
|
| 116 |
+
[[expr.prim.id.qual]], [[dcl.type.simple]], [[dcl.type.elab]], [[dcl.mptr]], [[namespace.udecl]], [[temp.param]], [[temp.names]], [[temp.res]]. — *end note*]
|
| 117 |
+
|
| 118 |
+
The *terminal name* of a construct is the component name of that
|
| 119 |
+
construct that appears lexically last.
|
| 120 |
+
|
| 121 |
+
The result is the entity denoted by the *unqualified-id*
|
| 122 |
+
[[basic.lookup.unqual]]. If the *unqualified-id* appears in a
|
| 123 |
+
*lambda-expression* at program point P and the entity is a local entity
|
| 124 |
+
[[basic.pre]] or a variable declared by an *init-capture*
|
| 125 |
+
[[expr.prim.lambda.capture]], then let S be the *compound-statement* of
|
| 126 |
+
the innermost enclosing *lambda-expression* of P. If naming the entity
|
| 127 |
+
from outside of an unevaluated operand within S would refer to an entity
|
| 128 |
+
captured by copy in some intervening *lambda-expression*, then let E be
|
| 129 |
+
the innermost such *lambda-expression*.
|
| 130 |
+
|
| 131 |
+
- If there is such a *lambda-expression* and if P is in E’s function
|
| 132 |
+
parameter scope but not its *parameter-declaration-clause*, then the
|
| 133 |
+
type of the expression is the type of a class member access expression
|
| 134 |
+
[[expr.ref]] naming the non-static data member that would be declared
|
| 135 |
+
for such a capture in the object parameter [[dcl.fct]] of the function
|
| 136 |
+
call operator of E. \[*Note 3*: If E is not declared `mutable`, the
|
| 137 |
type of such an identifier will typically be `const`
|
| 138 |
qualified. — *end note*]
|
| 139 |
+
- Otherwise (if there is no such *lambda-expression* or if P either
|
| 140 |
+
precedes E’s function parameter scope or is in E’s
|
| 141 |
+
*parameter-declaration-clause*), the type of the expression is the
|
| 142 |
+
type of the result.
|
| 143 |
|
| 144 |
+
[*Note 4*: If the entity is a template parameter object for a template
|
|
|
|
|
|
|
| 145 |
parameter of type `T` [[temp.param]], the type of the expression is
|
| 146 |
`const T`. — *end note*]
|
| 147 |
|
| 148 |
+
[*Note 5*: The type will be adjusted as described in [[expr.type]] if
|
| 149 |
it is cv-qualified or is a reference type. — *end note*]
|
| 150 |
|
| 151 |
+
The expression is an xvalue if it is move-eligible (see below); an
|
| 152 |
+
lvalue if the entity is a function, variable, structured binding
|
| 153 |
+
[[dcl.struct.bind]], data member, or template parameter object; and a
|
| 154 |
+
prvalue otherwise [[basic.lval]]; it is a bit-field if the identifier
|
| 155 |
+
designates a bit-field.
|
| 156 |
|
| 157 |
[*Example 1*:
|
| 158 |
|
| 159 |
``` cpp
|
| 160 |
void f() {
|
| 161 |
float x, &r = x;
|
| 162 |
+
|
| 163 |
+
[=]() -> decltype((x)) { // lambda returns float const& because this lambda is not mutable and
|
| 164 |
+
// x is an lvalue
|
| 165 |
decltype(x) y1; // y1 has type float
|
| 166 |
+
decltype((x)) y2 = y1; // y2 has type float const&
|
|
|
|
| 167 |
decltype(r) r1 = y1; // r1 has type float&
|
| 168 |
decltype((r)) r2 = y2; // r2 has type float const&
|
| 169 |
+
return y2;
|
| 170 |
+
};
|
| 171 |
+
|
| 172 |
+
[=](decltype((x)) y) {
|
| 173 |
+
decltype((x)) z = x; // OK, y has type float&, z has type float const&
|
| 174 |
+
};
|
| 175 |
+
|
| 176 |
+
[=] {
|
| 177 |
+
[](decltype((x)) y) {}; // OK, lambda takes a parameter of type float const&
|
| 178 |
+
|
| 179 |
+
[x=1](decltype((x)) y) {
|
| 180 |
+
decltype((x)) z = x; // OK, y has type int&, z has type int const&
|
| 181 |
+
};
|
| 182 |
};
|
| 183 |
}
|
| 184 |
```
|
| 185 |
|
| 186 |
— *end example*]
|
| 187 |
|
| 188 |
+
An *implicitly movable entity* is a variable of automatic storage
|
| 189 |
+
duration that is either a non-volatile object or an rvalue reference to
|
| 190 |
+
a non-volatile object type. In the following contexts, an
|
| 191 |
+
*id-expression* is *move-eligible*:
|
| 192 |
+
|
| 193 |
+
- If the *id-expression* (possibly parenthesized) is the operand of a
|
| 194 |
+
`return` [[stmt.return]] or `co_return` [[stmt.return.coroutine]]
|
| 195 |
+
statement, and names an implicitly movable entity declared in the body
|
| 196 |
+
or *parameter-declaration-clause* of the innermost enclosing function
|
| 197 |
+
or *lambda-expression*, or
|
| 198 |
+
- if the *id-expression* (possibly parenthesized) is the operand of a
|
| 199 |
+
*throw-expression* [[expr.throw]], and names an implicitly movable
|
| 200 |
+
entity that belongs to a scope that does not contain the
|
| 201 |
+
*compound-statement* of the innermost *lambda-expression*,
|
| 202 |
+
*try-block*, or *function-try-block* (if any) whose
|
| 203 |
+
*compound-statement* or *ctor-initializer* contains the
|
| 204 |
+
*throw-expression*.
|
| 205 |
+
|
| 206 |
#### Qualified names <a id="expr.prim.id.qual">[[expr.prim.id.qual]]</a>
|
| 207 |
|
| 208 |
``` bnf
|
| 209 |
qualified-id:
|
| 210 |
nested-name-specifier templateₒₚₜ unqualified-id
|
|
|
|
| 218 |
decltype-specifier '::'
|
| 219 |
nested-name-specifier identifier '::'
|
| 220 |
nested-name-specifier templateₒₚₜ simple-template-id '::'
|
| 221 |
```
|
| 222 |
|
| 223 |
+
The component names of a *qualified-id* are those of its
|
| 224 |
+
*nested-name-specifier* and *unqualified-id*. The component names of a
|
| 225 |
+
*nested-name-specifier* are its *identifier* (if any) and those of its
|
| 226 |
+
*type-name*, *namespace-name*, *simple-template-id*, and/or
|
| 227 |
+
*nested-name-specifier*.
|
| 228 |
+
|
| 229 |
+
A *nested-name-specifier* is *declarative* if it is part of
|
| 230 |
+
|
| 231 |
+
- a *class-head-name*,
|
| 232 |
+
- an *enum-head-name*,
|
| 233 |
+
- a *qualified-id* that is the *id-expression* of a *declarator-id*, or
|
| 234 |
+
- a declarative *nested-name-specifier*.
|
| 235 |
+
|
| 236 |
+
A declarative *nested-name-specifier* shall not have a
|
| 237 |
+
*decltype-specifier*. A declaration that uses a declarative
|
| 238 |
+
*nested-name-specifier* shall be a friend declaration or inhabit a scope
|
| 239 |
+
that contains the entity being redeclared or specialized.
|
| 240 |
+
|
| 241 |
+
The *nested-name-specifier* `::` nominates the global namespace. A
|
| 242 |
+
*nested-name-specifier* with a *decltype-specifier* nominates the type
|
| 243 |
+
denoted by the *decltype-specifier*, which shall be a class or
|
| 244 |
+
enumeration type. If a *nested-name-specifier* N is declarative and has
|
| 245 |
+
a *simple-template-id* with a template argument list A that involves a
|
| 246 |
+
template parameter, let T be the template nominated by N without A. T
|
| 247 |
+
shall be a class template.
|
| 248 |
+
|
| 249 |
+
- If A is the template argument list [[temp.arg]] of the corresponding
|
| 250 |
+
*template-head* H [[temp.mem]], N nominates the primary template of T;
|
| 251 |
+
H shall be equivalent to the *template-head* of T [[temp.over.link]].
|
| 252 |
+
- Otherwise, N nominates the partial specialization
|
| 253 |
+
[[temp.spec.partial]] of T whose template argument list is equivalent
|
| 254 |
+
to A [[temp.over.link]]; the program is ill-formed if no such partial
|
| 255 |
+
specialization exists.
|
| 256 |
+
|
| 257 |
+
Any other *nested-name-specifier* nominates the entity denoted by its
|
| 258 |
+
*type-name*, *namespace-name*, *identifier*, or *simple-template-id*. If
|
| 259 |
+
the *nested-name-specifier* is not declarative, the entity shall not be
|
| 260 |
+
a template.
|
| 261 |
+
|
| 262 |
+
A *qualified-id* shall not be of the form *nested-name-specifier*
|
| 263 |
+
`template`ₒₚₜ `~` *decltype-specifier* nor of the form
|
| 264 |
+
*decltype-specifier* `::` `~` *type-name*.
|
| 265 |
+
|
| 266 |
+
The result of a *qualified-id* Q is the entity it denotes
|
| 267 |
+
[[basic.lookup.qual]]. The type of the expression is the type of the
|
| 268 |
+
result. The result is an lvalue if the member is
|
| 269 |
+
|
| 270 |
+
- a function other than a non-static member function,
|
| 271 |
+
- a non-static member function if Q is the operand of a unary `&`
|
| 272 |
+
operator,
|
| 273 |
+
- a variable,
|
| 274 |
+
- a structured binding [[dcl.struct.bind]], or
|
| 275 |
+
- a data member,
|
| 276 |
+
|
| 277 |
and a prvalue otherwise.
|
| 278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
#### Destruction <a id="expr.prim.id.dtor">[[expr.prim.id.dtor]]</a>
|
| 280 |
|
| 281 |
An *id-expression* that denotes the destructor of a type `T` names the
|
| 282 |
destructor of `T` if `T` is a class type [[class.dtor]], otherwise the
|
| 283 |
*id-expression* is said to name a *pseudo-destructor*.
|
|
|
|
| 285 |
If the *id-expression* names a pseudo-destructor, `T` shall be a scalar
|
| 286 |
type and the *id-expression* shall appear as the right operand of a
|
| 287 |
class member access [[expr.ref]] that forms the *postfix-expression* of
|
| 288 |
a function call [[expr.call]].
|
| 289 |
|
| 290 |
+
[*Note 1*: Such a call ends the lifetime of the object
|
| 291 |
+
[[expr.call]], [[basic.life]]. — *end note*]
|
| 292 |
|
| 293 |
[*Example 1*:
|
| 294 |
|
| 295 |
``` cpp
|
| 296 |
struct C { };
|