Title
Out-of-class definition of member unscoped opaque enumeration
Status
drafting
Section
9.7.1 [dcl.enum]
Submitter
Richard Smith

Created on 2012-03-26.00:00:00 last changed 47 months ago

Messages

Date: 2012-10-15.00:00:00

Notes from the October, 2012 meeting:

CWG agreed that an unscoped opaque enumeration in class scope should be forbidden.

Date: 2012-03-26.00:00:00

The scope in which the names of enumerators are entered for a member unscoped opaque enumeration is not clear. According to 9.7.1 [dcl.enum] paragraph 10,

Each enum-name and each unscoped enumerator is declared in the scope that immediately contains the enum-specifier.

In the case of a member opaque enumeration defined outside its containing class, however, it is not clear whether the enumerator names are declared in the class scope or in the lexical scope containing the definition. Declaring them in the class scope would be a violation of 11.4 [class.mem] paragraph 1:

The member-specification in a class definition declares the full set of members of the class; no member can be added elsewhere.

Declaring the names in the lexical scope containing the definition would be contrary to the example in 13.7.2.6 [temp.mem.enum] paragraph 1:

  template<class T> struct A {
    enum E : T;
  };
  A<int> a;
  template<class T> enum A<T>::E : T { e1, e2 };
  A<int>::E e = A<int>::e1;

There also appear to be problems with the rules for dependent types and members of the current instantiation.

History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6241
2012-11-03 00:00:00adminsetstatus: open -> drafting
2012-03-26 00:00:00admincreate