I'm not sure... but it appears to be an error in the book..(Anyone willing to verify in in the Standard Doc ? I'm afraid of reading them!)
Anyway.. I get an error for
Code:
enum class foo{a,b,c};
using namespace foo; // Same for "using foo::a;"
int main()
{
foo x = a;
return 0;
}
[manasij7479@manasijn ~]$ g++ a.cpp -std=c++0x
a.cpp:3:17: error: ‘foo’ is not a namespace-name
a.cpp:3:20: error: expected namespace-name before ‘;’ token
a.cpp: In function ‘int main()’:
a.cpp:6:13: error: ‘a’ was not declared in this scope
But not for
Code:
enum class foo{a,b,c};
int main()
{
foo x = foo::a;
return 0;
}
P.S : It could also be a bug in the compiler. But it is unlikely..as my version's C++11 support for strong enums is marked as complete.