This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


1742. using-declarations and scoped enumerators

Section: 9.9  [namespace.udecl]     Status: CD5     Submitter: Richard Smith     Date: 2013-08-28

[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?