tmp/tmpwioph466/{from.md → to.md}
RENAMED
|
@@ -33,20 +33,26 @@ class whenever it is named.
|
|
| 33 |
resolves to a *class-name* or *enum-name*, the
|
| 34 |
*elaborated-type-specifier* introduces it into the declaration the same
|
| 35 |
way a *simple-type-specifier* introduces its *type-name*. If the
|
| 36 |
*identifier* resolves to a *typedef-name* or the *simple-template-id*
|
| 37 |
resolves to an alias template specialization, the
|
| 38 |
-
*elaborated-type-specifier* is ill-formed.
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
``` cpp
|
| 42 |
friend class T;
|
| 43 |
```
|
| 44 |
|
| 45 |
is ill-formed. However, the similar declaration `friend T;` is allowed (
|
| 46 |
[[class.friend]]).
|
| 47 |
|
|
|
|
|
|
|
| 48 |
The *class-key* or `enum` keyword present in the
|
| 49 |
*elaborated-type-specifier* shall agree in kind with the declaration to
|
| 50 |
which the name in the *elaborated-type-specifier* refers. This rule also
|
| 51 |
applies to the form of *elaborated-type-specifier* that declares a
|
| 52 |
*class-name* or `friend` class since it can be construed as referring to
|
|
@@ -55,10 +61,14 @@ the `enum` keyword shall be used to refer to an enumeration (
|
|
| 55 |
[[dcl.enum]]), the `union` *class-key* shall be used to refer to a union
|
| 56 |
(Clause [[class]]), and either the `class` or `struct` *class-key*
|
| 57 |
shall be used to refer to a class (Clause [[class]]) declared using the
|
| 58 |
`class` or `struct` *class-key*.
|
| 59 |
|
|
|
|
|
|
|
| 60 |
``` cpp
|
| 61 |
enum class E { a, b };
|
| 62 |
enum E x = E::a; // OK
|
| 63 |
```
|
| 64 |
|
|
|
|
|
|
|
|
|
| 33 |
resolves to a *class-name* or *enum-name*, the
|
| 34 |
*elaborated-type-specifier* introduces it into the declaration the same
|
| 35 |
way a *simple-type-specifier* introduces its *type-name*. If the
|
| 36 |
*identifier* resolves to a *typedef-name* or the *simple-template-id*
|
| 37 |
resolves to an alias template specialization, the
|
| 38 |
+
*elaborated-type-specifier* is ill-formed.
|
| 39 |
+
|
| 40 |
+
[*Note 1*:
|
| 41 |
+
|
| 42 |
+
This implies that, within a class template with a template
|
| 43 |
+
*type-parameter* `T`, the declaration
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
friend class T;
|
| 47 |
```
|
| 48 |
|
| 49 |
is ill-formed. However, the similar declaration `friend T;` is allowed (
|
| 50 |
[[class.friend]]).
|
| 51 |
|
| 52 |
+
— *end note*]
|
| 53 |
+
|
| 54 |
The *class-key* or `enum` keyword present in the
|
| 55 |
*elaborated-type-specifier* shall agree in kind with the declaration to
|
| 56 |
which the name in the *elaborated-type-specifier* refers. This rule also
|
| 57 |
applies to the form of *elaborated-type-specifier* that declares a
|
| 58 |
*class-name* or `friend` class since it can be construed as referring to
|
|
|
|
| 61 |
[[dcl.enum]]), the `union` *class-key* shall be used to refer to a union
|
| 62 |
(Clause [[class]]), and either the `class` or `struct` *class-key*
|
| 63 |
shall be used to refer to a class (Clause [[class]]) declared using the
|
| 64 |
`class` or `struct` *class-key*.
|
| 65 |
|
| 66 |
+
[*Example 1*:
|
| 67 |
+
|
| 68 |
``` cpp
|
| 69 |
enum class E { a, b };
|
| 70 |
enum E x = E::a; // OK
|
| 71 |
```
|
| 72 |
|
| 73 |
+
— *end example*]
|
| 74 |
+
|