tmp/tmpzl7z4uo_/{from.md → to.md}
RENAMED
|
@@ -8,61 +8,123 @@ qualified-id:
|
|
| 8 |
``` bnf
|
| 9 |
nested-name-specifier:
|
| 10 |
'::'
|
| 11 |
type-name '::'
|
| 12 |
namespace-name '::'
|
| 13 |
-
|
|
|
|
| 14 |
nested-name-specifier identifier '::'
|
| 15 |
nested-name-specifier templateₒₚₜ simple-template-id '::'
|
| 16 |
```
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
The component names of a *qualified-id* are those of its
|
| 19 |
*nested-name-specifier* and *unqualified-id*. The component names of a
|
| 20 |
*nested-name-specifier* are its *identifier* (if any) and those of its
|
| 21 |
*type-name*, *namespace-name*, *simple-template-id*, and/or
|
| 22 |
*nested-name-specifier*.
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
A *nested-name-specifier* is *declarative* if it is part of
|
| 25 |
|
| 26 |
- a *class-head-name*,
|
| 27 |
- an *enum-head-name*,
|
| 28 |
- a *qualified-id* that is the *id-expression* of a *declarator-id*, or
|
| 29 |
- a declarative *nested-name-specifier*.
|
| 30 |
|
| 31 |
A declarative *nested-name-specifier* shall not have a
|
| 32 |
-
*
|
| 33 |
-
*nested-name-specifier* shall be a friend
|
| 34 |
-
that contains the entity being redeclared
|
|
|
|
| 35 |
|
| 36 |
-
The *nested-name-specifier*
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
template parameter, let T be the template nominated by N without A. T
|
| 42 |
shall be a class template.
|
| 43 |
-
|
| 44 |
- If A is the template argument list [[temp.arg]] of the corresponding
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
Any other *nested-name-specifier*
|
| 53 |
-
*type-name*, *namespace-name*, *identifier*, or *simple-template-id*.
|
| 54 |
-
the *nested-name-specifier* is not declarative, the entity shall
|
| 55 |
-
a template.
|
| 56 |
|
| 57 |
A *qualified-id* shall not be of the form *nested-name-specifier*
|
| 58 |
-
`template`ₒₚₜ `~` *
|
| 59 |
-
*
|
| 60 |
|
| 61 |
The result of a *qualified-id* Q is the entity it denotes
|
| 62 |
-
[[basic.lookup.qual]].
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
- a function other than a non-static member function,
|
| 66 |
- a non-static member function if Q is the operand of a unary `&`
|
| 67 |
operator,
|
| 68 |
- a variable,
|
|
|
|
| 8 |
``` bnf
|
| 9 |
nested-name-specifier:
|
| 10 |
'::'
|
| 11 |
type-name '::'
|
| 12 |
namespace-name '::'
|
| 13 |
+
computed-type-specifier '::'
|
| 14 |
+
splice-scope-specifier '::'
|
| 15 |
nested-name-specifier identifier '::'
|
| 16 |
nested-name-specifier templateₒₚₜ simple-template-id '::'
|
| 17 |
```
|
| 18 |
|
| 19 |
+
``` bnf
|
| 20 |
+
splice-scope-specifier:
|
| 21 |
+
splice-specifier
|
| 22 |
+
templateₒₚₜ splice-specialization-specifier
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
The component names of a *qualified-id* are those of its
|
| 26 |
*nested-name-specifier* and *unqualified-id*. The component names of a
|
| 27 |
*nested-name-specifier* are its *identifier* (if any) and those of its
|
| 28 |
*type-name*, *namespace-name*, *simple-template-id*, and/or
|
| 29 |
*nested-name-specifier*.
|
| 30 |
|
| 31 |
+
A *splice-specifier* or *splice-specialization-specifier* that is not
|
| 32 |
+
followed by `::` is never interpreted as part of a
|
| 33 |
+
*splice-scope-specifier*. The keyword `template` may only be omitted
|
| 34 |
+
from the form `\opt{template} splice-specialization-specifier ::` when
|
| 35 |
+
the *splice-specialization-specifier* is preceded by `typename`.
|
| 36 |
+
|
| 37 |
+
[*Example 1*:
|
| 38 |
+
|
| 39 |
+
``` cpp
|
| 40 |
+
template<int V>
|
| 41 |
+
struct TCls {
|
| 42 |
+
static constexpr int s = V;
|
| 43 |
+
using type = int;
|
| 44 |
+
};
|
| 45 |
+
|
| 46 |
+
int v1 = [:^^TCls<1>:]::s;
|
| 47 |
+
int v2 = template [:^^TCls:]<2>::s; // OK, template binds to splice-scope-specifier
|
| 48 |
+
typename [:^^TCls:]<3>::type v3 = 3; // OK, typename binds to the qualified name
|
| 49 |
+
template [:^^TCls:]<3>::type v4 = 4; // OK, template binds to the splice-scope-specifier
|
| 50 |
+
typename template [:^^TCls:]<3>::type v5 = 5; // OK, same as v3
|
| 51 |
+
[:^^TCls:]<3>::type v6 = 6; // error: unexpected <
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
— *end example*]
|
| 55 |
+
|
| 56 |
A *nested-name-specifier* is *declarative* if it is part of
|
| 57 |
|
| 58 |
- a *class-head-name*,
|
| 59 |
- an *enum-head-name*,
|
| 60 |
- a *qualified-id* that is the *id-expression* of a *declarator-id*, or
|
| 61 |
- a declarative *nested-name-specifier*.
|
| 62 |
|
| 63 |
A declarative *nested-name-specifier* shall not have a
|
| 64 |
+
*computed-type-specifier* or a *splice-scope-specifier*. A declaration
|
| 65 |
+
that uses a declarative *nested-name-specifier* shall be a friend
|
| 66 |
+
declaration or inhabit a scope that contains the entity being redeclared
|
| 67 |
+
or specialized.
|
| 68 |
|
| 69 |
+
The entity designated by a *nested-name-specifier* is determined as
|
| 70 |
+
follows:
|
| 71 |
+
|
| 72 |
+
- The *nested-name-specifier* `::` designates the global namespace.
|
| 73 |
+
- A *nested-name-specifier* with a *computed-type-specifier* designates
|
| 74 |
+
the same type designated by the *computed-type-specifier*, which shall
|
| 75 |
+
be a class or enumeration type.
|
| 76 |
+
- For a *nested-name-specifier* of the form `splice-specifier ::`, the
|
| 77 |
+
*splice-specifier* shall designate a class or enumeration type or a
|
| 78 |
+
namespace. The *nested-name-specifier* designates the same entity as
|
| 79 |
+
the *splice-specifier*.
|
| 80 |
+
- For a *nested-name-specifier* of the form
|
| 81 |
+
`\opt{template} splice-specialization-specifier ::`, the
|
| 82 |
+
*splice-specifier* of the *splice-specialization-specifier* shall
|
| 83 |
+
designate a class template or an alias template T. Letting S be the
|
| 84 |
+
specialization of T corresponding to the template argument list of the
|
| 85 |
+
*splice-specialization-specifier*, S shall either be a class template
|
| 86 |
+
specialization or an alias template specialization that denotes a
|
| 87 |
+
class or enumeration type. The *nested-name-specifier* designates the
|
| 88 |
+
underlying entity of S.
|
| 89 |
+
- If a *nested-name-specifier* N is declarative and has a
|
| 90 |
+
*simple-template-id* with a template argument list A that involves a
|
| 91 |
template parameter, let T be the template nominated by N without A. T
|
| 92 |
shall be a class template.
|
|
|
|
| 93 |
- If A is the template argument list [[temp.arg]] of the corresponding
|
| 94 |
+
*template-head* H [[temp.mem]], N designates the primary template of
|
| 95 |
+
T; H shall be equivalent to the *template-head* of T
|
| 96 |
+
[[temp.over.link]].
|
| 97 |
+
- Otherwise, N designates the partial specialization
|
| 98 |
+
[[temp.spec.partial]] of T whose template argument list is
|
| 99 |
+
equivalent to A [[temp.over.link]]; the program is ill-formed if no
|
| 100 |
+
such partial specialization exists.
|
| 101 |
+
- Any other *nested-name-specifier* designates the entity denotes by its
|
| 102 |
+
*type-name*, *namespace-name*, *identifier*, or *simple-template-id*.
|
| 103 |
+
If the *nested-name-specifier* is not declarative, the entity shall
|
| 104 |
+
not be a template.
|
| 105 |
|
| 106 |
A *qualified-id* shall not be of the form *nested-name-specifier*
|
| 107 |
+
`template`ₒₚₜ `~` *computed-type-specifier* nor of the form
|
| 108 |
+
*computed-type-specifier* `::` `~` *type-name*.
|
| 109 |
|
| 110 |
The result of a *qualified-id* Q is the entity it denotes
|
| 111 |
+
[[basic.lookup.qual]].
|
| 112 |
+
|
| 113 |
+
If Q appears in the predicate of a contract assertion C
|
| 114 |
+
[[basic.contract]] and the entity is
|
| 115 |
+
|
| 116 |
+
- a variable declared outside of C of object type `T`,
|
| 117 |
+
- a variable declared outside of C of type “reference to `T`”, or
|
| 118 |
+
- a structured binding of type `T` whose corresponding variable is
|
| 119 |
+
declared outside of C,
|
| 120 |
+
|
| 121 |
+
then the type of the expression is `const` `T`.
|
| 122 |
+
|
| 123 |
+
Otherwise, the type of the expression is the type of the result.
|
| 124 |
+
|
| 125 |
+
The result is an lvalue if the member is
|
| 126 |
|
| 127 |
- a function other than a non-static member function,
|
| 128 |
- a non-static member function if Q is the operand of a unary `&`
|
| 129 |
operator,
|
| 130 |
- a variable,
|