You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the code sample that demonsrates the problem
structS
{
enum T { A };
enumclassU { B };
};
intmain()
{
S s;
S::A; // OK
S::T::A; // OK
S::U::B; // OK
s.A; // OK
s.T::A; // OK
s.U::B; // Error???
}
All six lines that refer to enumerators from enums declared inside class S are perfectly valid. However, Clang issues an error
error: 'S::U::B' is not a member of class 'S'
17 | s.U::B; // Error???
| ~~~^
for last one (i.e. s.U::B). Why?
What makes it especially weird is that Clang has no problems with the qualified name in the s.T::A line, i.e. it does allow one to optionally use a qualified name to access enumerators from a "classic" unscoped enum (using qualified name with such enums is a possibility since C++11). However, for some unknown reason Clang rejects a similar attempt to access an enumerator from a scoped enum.