Title
using-declarations and scoped enumerators
Status
cd5
Section
9.9 [namespace.udecl]
Submitter
Richard Smith

Created on 2013-08-28.00:00:00 last changed 24 months ago

Messages

Date: 2019-07-15.00:00:00

[Accepted at the July, 2019 meeting as part of paper P1099R5 (Using enum).]

A using-declaration cannot name a scoped enumerator, according to 9.9 [namespace.udecl] paragraph 7. This is presumably because a scoped enumerator belongs to an enumeration scope and thus logically cannot belong to the non-enumeration scope in which the using-declaration appears. It seems inconsistent, however, to permit using-declarations to name unscoped enumerators but not scoped enumerators.

Also, 9.9 [namespace.udecl] paragraph 3 says,

In a using-declaration used as a member-declaration, the nested-name-specifier shall name a base class of the class being defined.

The consequence of this is that

  enum E { e0 };
  void f() {
    using E::e0;
  }

is well-formed, but

  struct B {
    enum E { e0 };
  };
  struct D : B {
    using B::E::e0;
  };

is not. Again, this seems inconsistent. Should these rules be relaxed?

History
Date User Action Args
2022-04-27 08:26:54adminsetstatus: open -> cd5
2013-08-28 00:00:00admincreate