Open
Description
[enum.udecl]/2 contains this example:
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
}
While it is correct that name lookup for orange
in s.orange
will find fruit::orange
, the member access expression itself is not ok, because [expr.ref]/7.5 only specifies its behavior for member enumerators. using enum
however doesn't make the enumerator a member enumerator ([class.mem.general]/3.5, [class.mem.general]/4).
Currently [expr.ref] simply lacks a statement about the behavior in this situation, but CWG issue 2902's proposed resolution would clarify that it is ill-formed.
From issue reported to Clang here.