tmp/tmp62ye_h1_/{from.md → to.md}
RENAMED
|
@@ -1,69 +1,49 @@
|
|
| 1 |
### Elaborated type specifiers <a id="basic.lookup.elab">[[basic.lookup.elab]]</a>
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
ignoring any non-type names that have been declared. If the
|
| 17 |
-
*elaborated-type-specifier* is introduced by the `enum` keyword and this
|
| 18 |
-
lookup does not find a previously declared *type-name*, the
|
| 19 |
-
*elaborated-type-specifier* is ill-formed. If the
|
| 20 |
-
*elaborated-type-specifier* is introduced by the *class-key* and this
|
| 21 |
-
lookup does not find a previously declared *type-name*, or if the
|
| 22 |
-
*elaborated-type-specifier* appears in a declaration with the form:
|
| 23 |
-
|
| 24 |
-
``` bnf
|
| 25 |
-
class-key attribute-specifier-seqₒₚₜ identifier ';'
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
the *elaborated-type-specifier* is a declaration that introduces the
|
| 29 |
-
*class-name* as described in [[basic.scope.pdecl]].
|
| 30 |
-
|
| 31 |
-
If the *elaborated-type-specifier* has a *nested-name-specifier*,
|
| 32 |
-
qualified name lookup is performed, as described in
|
| 33 |
-
[[basic.lookup.qual]], but ignoring any non-type names that have been
|
| 34 |
-
declared. If the name lookup does not find a previously declared
|
| 35 |
-
*type-name*, the *elaborated-type-specifier* is ill-formed.
|
| 36 |
|
| 37 |
[*Example 1*:
|
| 38 |
|
| 39 |
``` cpp
|
| 40 |
struct Node {
|
| 41 |
-
struct Node* Next; // OK
|
| 42 |
-
struct Data* Data; // OK
|
| 43 |
};
|
| 44 |
|
| 45 |
struct Data {
|
| 46 |
-
struct Node* Node; // OK
|
| 47 |
friend struct ::Glob; // error: Glob is not declared, cannot introduce a qualified type[dcl.type.elab]
|
| 48 |
-
friend struct Glob; // OK
|
| 49 |
...
|
| 50 |
};
|
| 51 |
|
| 52 |
struct Base {
|
| 53 |
-
struct Data; // OK
|
| 54 |
-
struct ::Data* thatData; // OK
|
| 55 |
-
struct Base::Data* thisData; // OK
|
| 56 |
-
friend class ::Data; // OK
|
| 57 |
-
friend class Data; // OK
|
| 58 |
struct Data { ... }; // Defines nested Data
|
| 59 |
};
|
| 60 |
|
| 61 |
-
struct Data; // OK
|
| 62 |
struct ::Data; // error: cannot introduce a qualified type[dcl.type.elab]
|
| 63 |
struct Base::Data; // error: cannot introduce a qualified type[dcl.type.elab]
|
| 64 |
struct Base::Datum; // error: Datum undefined
|
| 65 |
-
struct Base::Data* pBase; // OK
|
| 66 |
```
|
| 67 |
|
| 68 |
— *end example*]
|
| 69 |
|
|
|
|
| 1 |
### Elaborated type specifiers <a id="basic.lookup.elab">[[basic.lookup.elab]]</a>
|
| 2 |
|
| 3 |
+
If the *class-key* or `enum` keyword in an *elaborated-type-specifier*
|
| 4 |
+
is followed by an *identifier* that is not followed by `::`, lookup for
|
| 5 |
+
the *identifier* is type-only [[basic.lookup.general]].
|
| 6 |
+
|
| 7 |
+
[*Note 1*: In general, the recognition of an
|
| 8 |
+
*elaborated-type-specifier* depends on the following tokens. If the
|
| 9 |
+
*identifier* is followed by `::`, see
|
| 10 |
+
[[basic.lookup.qual]]. — *end note*]
|
| 11 |
+
|
| 12 |
+
If the terminal name of the *elaborated-type-specifier* is a qualified
|
| 13 |
+
name, lookup for it is type-only. If the name lookup does not find a
|
| 14 |
+
previously declared *type-name*, the *elaborated-type-specifier* is
|
| 15 |
+
ill-formed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
[*Example 1*:
|
| 18 |
|
| 19 |
``` cpp
|
| 20 |
struct Node {
|
| 21 |
+
struct Node* Next; // OK, refers to injected-class-name Node
|
| 22 |
+
struct Data* Data; // OK, declares type Data at global scope and member Data
|
| 23 |
};
|
| 24 |
|
| 25 |
struct Data {
|
| 26 |
+
struct Node* Node; // OK, refers to Node at global scope
|
| 27 |
friend struct ::Glob; // error: Glob is not declared, cannot introduce a qualified type[dcl.type.elab]
|
| 28 |
+
friend struct Glob; // OK, refers to (as yet) undeclared Glob at global scope.
|
| 29 |
...
|
| 30 |
};
|
| 31 |
|
| 32 |
struct Base {
|
| 33 |
+
struct Data; // OK, declares nested Data
|
| 34 |
+
struct ::Data* thatData; // OK, refers to ::Data
|
| 35 |
+
struct Base::Data* thisData; // OK, refers to nested Data
|
| 36 |
+
friend class ::Data; // OK, global Data is a friend
|
| 37 |
+
friend class Data; // OK, nested Data is a friend
|
| 38 |
struct Data { ... }; // Defines nested Data
|
| 39 |
};
|
| 40 |
|
| 41 |
+
struct Data; // OK, redeclares Data at global scope
|
| 42 |
struct ::Data; // error: cannot introduce a qualified type[dcl.type.elab]
|
| 43 |
struct Base::Data; // error: cannot introduce a qualified type[dcl.type.elab]
|
| 44 |
struct Base::Datum; // error: Datum undefined
|
| 45 |
+
struct Base::Data* pBase; // OK, refers to nested Data
|
| 46 |
```
|
| 47 |
|
| 48 |
— *end example*]
|
| 49 |
|