tmp/tmpqtdva44r/{from.md → to.md}
RENAMED
|
@@ -7,26 +7,48 @@ using-enum-declaration:
|
|
| 7 |
|
| 8 |
``` bnf
|
| 9 |
using-enum-declarator:
|
| 10 |
nested-name-specifierₒₚₜ identifier
|
| 11 |
nested-name-specifierₒₚₜ simple-template-id
|
|
|
|
| 12 |
```
|
| 13 |
|
| 14 |
-
A *using-enum-declarator*
|
| 15 |
-
|
| 16 |
-
*using-enum-declarator*
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
A *using-enum-declaration* is equivalent to a *using-declaration* for
|
| 20 |
each enumerator.
|
| 21 |
|
| 22 |
[*Note 1*:
|
| 23 |
|
| 24 |
A *using-enum-declaration* in class scope makes the enumerators of the
|
| 25 |
named enumeration available via member lookup.
|
| 26 |
|
| 27 |
-
[*Example
|
| 28 |
|
| 29 |
``` cpp
|
| 30 |
enum class fruit { orange, apple };
|
| 31 |
struct S {
|
| 32 |
using enum fruit; // OK, introduces orange and apple into S
|
|
@@ -45,11 +67,11 @@ void f() {
|
|
| 45 |
[*Note 2*:
|
| 46 |
|
| 47 |
Two *using-enum-declaration*s that introduce two enumerators of the same
|
| 48 |
name conflict.
|
| 49 |
|
| 50 |
-
[*Example
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
enum class fruit { orange, apple };
|
| 54 |
enum class color { red, orange };
|
| 55 |
void f() {
|
|
|
|
| 7 |
|
| 8 |
``` bnf
|
| 9 |
using-enum-declarator:
|
| 10 |
nested-name-specifierₒₚₜ identifier
|
| 11 |
nested-name-specifierₒₚₜ simple-template-id
|
| 12 |
+
splice-type-specifier
|
| 13 |
```
|
| 14 |
|
| 15 |
+
A *using-enum-declarator* of the form *splice-type-specifier* designates
|
| 16 |
+
the same type designated by the *splice-type-specifier*. Any other
|
| 17 |
+
*using-enum-declarator* names the set of declarations found by type-only
|
| 18 |
+
lookup [[basic.lookup.general]] for the *using-enum-declarator*
|
| 19 |
+
[[basic.lookup.unqual]], [[basic.lookup.qual]]. The
|
| 20 |
+
*using-enum-declarator* shall designate a non-dependent type with a
|
| 21 |
+
reachable *enum-specifier*.
|
| 22 |
+
|
| 23 |
+
[*Example 1*:
|
| 24 |
+
|
| 25 |
+
``` cpp
|
| 26 |
+
enum E { x };
|
| 27 |
+
void f() {
|
| 28 |
+
int E;
|
| 29 |
+
using enum E; // OK
|
| 30 |
+
}
|
| 31 |
+
using F = E;
|
| 32 |
+
using enum F; // OK
|
| 33 |
+
template<class T> using EE = T;
|
| 34 |
+
void g() {
|
| 35 |
+
using enum EE<E>; // OK
|
| 36 |
+
}
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
— *end example*]
|
| 40 |
|
| 41 |
A *using-enum-declaration* is equivalent to a *using-declaration* for
|
| 42 |
each enumerator.
|
| 43 |
|
| 44 |
[*Note 1*:
|
| 45 |
|
| 46 |
A *using-enum-declaration* in class scope makes the enumerators of the
|
| 47 |
named enumeration available via member lookup.
|
| 48 |
|
| 49 |
+
[*Example 2*:
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
enum class fruit { orange, apple };
|
| 53 |
struct S {
|
| 54 |
using enum fruit; // OK, introduces orange and apple into S
|
|
|
|
| 67 |
[*Note 2*:
|
| 68 |
|
| 69 |
Two *using-enum-declaration*s that introduce two enumerators of the same
|
| 70 |
name conflict.
|
| 71 |
|
| 72 |
+
[*Example 3*:
|
| 73 |
|
| 74 |
``` cpp
|
| 75 |
enum class fruit { orange, apple };
|
| 76 |
enum class color { red, orange };
|
| 77 |
void f() {
|