Title
Naming enumerators in class member access expressions
Status
open
Section
7.6.1.5 [expr.ref]
Submitter
keinflue

Created on 2024-11-04.00:00:00 last changed 1 month ago

Messages

Date: 2024-12-06.16:08:24

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.

History
Date User Action Args
2024-11-04 00:00:00admincreate