From Jason Turner

[enum]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9xjseigh/{from.md → to.md} +32 -11
tmp/tmp9xjseigh/{from.md → to.md} RENAMED
@@ -105,15 +105,14 @@ ignored. An *opaque-enum-declaration* declaring an unscoped enumeration
105
  shall not omit the *enum-base*. The identifiers in an *enumerator-list*
106
  are declared as constants, and can appear wherever constants are
107
  required. The same identifier shall not appear as the name of multiple
108
  enumerators in an *enumerator-list*. An *enumerator-definition* with `=`
109
  gives the associated *enumerator* the value indicated by the
110
- *constant-expression*. If the first *enumerator* has no *initializer*,
111
- the value of the corresponding constant is zero. An
112
- *enumerator-definition* without an *initializer* gives the *enumerator*
113
- the value obtained by increasing the value of the previous *enumerator*
114
- by one.
115
 
116
  [*Example 2*:
117
 
118
  ``` cpp
119
  enum { a, b, c=0 };
@@ -287,26 +286,48 @@ using-enum-declaration:
287
 
288
  ``` bnf
289
  using-enum-declarator:
290
  nested-name-specifierₒₚₜ identifier
291
  nested-name-specifierₒₚₜ simple-template-id
 
292
  ```
293
 
294
- A *using-enum-declarator* names the set of declarations found by lookup
295
- [[basic.lookup.unqual]], [[basic.lookup.qual]] for the
296
- *using-enum-declarator*. The *using-enum-declarator* shall designate a
297
- non-dependent type with a reachable *enum-specifier*.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
 
299
  A *using-enum-declaration* is equivalent to a *using-declaration* for
300
  each enumerator.
301
 
302
  [*Note 1*:
303
 
304
  A *using-enum-declaration* in class scope makes the enumerators of the
305
  named enumeration available via member lookup.
306
 
307
- [*Example 1*:
308
 
309
  ``` cpp
310
  enum class fruit { orange, apple };
311
  struct S {
312
  using enum fruit; // OK, introduces orange and apple into S
@@ -325,11 +346,11 @@ void f() {
325
  [*Note 2*:
326
 
327
  Two *using-enum-declaration*s that introduce two enumerators of the same
328
  name conflict.
329
 
330
- [*Example 2*:
331
 
332
  ``` cpp
333
  enum class fruit { orange, apple };
334
  enum class color { red, orange };
335
  void f() {
 
105
  shall not omit the *enum-base*. The identifiers in an *enumerator-list*
106
  are declared as constants, and can appear wherever constants are
107
  required. The same identifier shall not appear as the name of multiple
108
  enumerators in an *enumerator-list*. An *enumerator-definition* with `=`
109
  gives the associated *enumerator* the value indicated by the
110
+ *constant-expression*. An *enumerator-definition* without `=` gives the
111
+ associated *enumerator* the value zero if it is the first
112
+ *enumerator-definition*, and the value of the previous *enumerator*
113
+ increased by one otherwise.
 
114
 
115
  [*Example 2*:
116
 
117
  ``` cpp
118
  enum { a, b, c=0 };
 
286
 
287
  ``` bnf
288
  using-enum-declarator:
289
  nested-name-specifierₒₚₜ identifier
290
  nested-name-specifierₒₚₜ simple-template-id
291
+ splice-type-specifier
292
  ```
293
 
294
+ A *using-enum-declarator* of the form *splice-type-specifier* designates
295
+ the same type designated by the *splice-type-specifier*. Any other
296
+ *using-enum-declarator* names the set of declarations found by type-only
297
+ lookup [[basic.lookup.general]] for the *using-enum-declarator*
298
+ [[basic.lookup.unqual]], [[basic.lookup.qual]]. The
299
+ *using-enum-declarator* shall designate a non-dependent type with a
300
+ reachable *enum-specifier*.
301
+
302
+ [*Example 1*:
303
+
304
+ ``` cpp
305
+ enum E { x };
306
+ void f() {
307
+ int E;
308
+ using enum E; // OK
309
+ }
310
+ using F = E;
311
+ using enum F; // OK
312
+ template<class T> using EE = T;
313
+ void g() {
314
+ using enum EE<E>; // OK
315
+ }
316
+ ```
317
+
318
+ — *end example*]
319
 
320
  A *using-enum-declaration* is equivalent to a *using-declaration* for
321
  each enumerator.
322
 
323
  [*Note 1*:
324
 
325
  A *using-enum-declaration* in class scope makes the enumerators of the
326
  named enumeration available via member lookup.
327
 
328
+ [*Example 2*:
329
 
330
  ``` cpp
331
  enum class fruit { orange, apple };
332
  struct S {
333
  using enum fruit; // OK, introduces orange and apple into S
 
346
  [*Note 2*:
347
 
348
  Two *using-enum-declaration*s that introduce two enumerators of the same
349
  name conflict.
350
 
351
+ [*Example 3*:
352
 
353
  ``` cpp
354
  enum class fruit { orange, apple };
355
  enum class color { red, orange };
356
  void f() {