https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26950
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It's "fixed" for C++11 because N::a is meaningful for scoped enums, and fails
to find it. But the code is invalid even in C++03.
Clang and EDG both reject this even in C++03 mode. We might want to do the
same.
EDG with --c++03 says:
"e.C", line 3: error: name followed by "::" must be a class or namespace name
enum N { e0 = N::a };
^
"e.C", line 2: warning: variable "N::a" was declared but never referenced
const int a = 42;
^
1 error detected in the compilation of "e.C".
Clang says:
e.C:3:19: warning: use of enumeration in a nested name specifier is a C++11
extension [-Wc++11-extensions]
enum N { e0 = N::a };
^
e.C:3:19: error: no member named 'a' in 'N::N'; did you mean simply 'a'?
enum N { e0 = N::a };
^~~~
a
e.C:2:15: note: 'a' declared here
const int a = 42;
^
1 warning and 1 error generated.