https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67663
Bug ID: 67663 Summary: ambiguous namespace/class name not reported as error Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: andreim77 at yahoo dot com Target Milestone: --- #include <iostream> struct a { static const int i=0; }; namespace x { namespace a { int i; } } using namespace x; int main() { a::i=1; std::cout << "i = " << a::i; return 0; } no error with GCC clang report: main.cpp:17:5: error: 'a' is not a class, namespace, or enumeration a::i=1; ^ main.cpp:17:5: error: reference to 'a' is ambiguous a::i=1; ^ main.cpp:3:8: note: candidate found by name lookup is 'a' struct a { ^ main.cpp:8:15: note: candidate found by name lookup is 'x::a' namespace a { ^ main.cpp:18:28: error: 'a' is not a class, namespace, or enumeration std::cout << "i = " << a::i; ^ main.cpp:18:28: error: reference to 'a' is ambiguous std::cout << "i = " << a::i; ^ main.cpp:3:8: note: candidate found by name lookup is 'a' struct a { ^ main.cpp:8:15: note: candidate found by name lookup is 'x::a' namespace a { ^ main.cpp:20:2: error: no newline at end of file [-Werror,-Wnewline-eof] } ^ 5 errors generated.