This is similar to, but not exactly like, bug 16782 $ cat junk.cc void ::foo() { } $ /usr/local/gcc-3.4.2/bin/g++ -c junk.cc -Wall $ edgcpfe junk.cc "junk.cc", line 1: error: the global scope has no "foo" void ::foo() { } ^ 1 error detected in the compilation of "junk.cc". The Standard (ISO+IEC+14882-1998) says in 8.3 paragraph 1: When the declarator-id is qualified, the declaration shall refer to a previously declared member of the class or namespace to which the qualifier refers, and the member shall not have been introduced by a usingdeclaration in the scope of the class or namespace nominated by the nested-name-specifier of the declarator-id.
Confirmed.
This is more or less a duplicate of PR 18466. The problem was fixed on mainline by Mark. He also added the testcase g++.dg/parse/qualified3.C which contains the example above. So let's track the problem in PR 18466. *** This bug has been marked as a duplicate of 18466 ***