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 2 weeks ago

Messages

Date: 2024-11-04.00:00:00

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.

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