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

2024-12-19


2959. Naming enumerators in class member access expressions

Section: 7.6.1.5  [expr.ref]     Status: open     Submitter: keinflue     Date: 2024-11-04

While lookup for a member enumerator is supported using class member access syntax (7.6.1.5 [expr.ref] bullet 7.5, the following example from 9.7.2 [enum.udecl] paragraph 2 is ill-formed:

  enum class fruit { orange, apple };
  struct S {
   using enum fruit;       // OK, introduces orange and apple into S
  };
  void f() {
   S s;
   s.orange;           // OK, names fruit::orange
   S::orange;          // OK, names fruit::orange
  }

Additional examples to consider:

  enum class fruit { orange };
  struct S { using fruit::orange; } s;
  auto a = s.S::orange; // OK?
  auto b = s.fruit::orange; // OK?
  struct T { using fruit::orange; } t;
  auto c = s.T::orange; // OK?

"Using enum" was introduced by paper P1099R5.

Issue 2557 makes the original example well-formed, but none of the qualified additional examples.