http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60565
--- Comment #4 from patrick at parcs dot ath.cx --- (In reply to Jonathan Wakely from comment #3) > (In reply to patrick from comment #1) > > Er, sorry, the call to "foo ()" within main ought to be "B::foo ()". > > OK, in that case you need to fix the declaration of B::foo() if you want to > call it. I think G++ is ignoring the inconsistent declaration of B::foo(). > I'm not sure if that's correct, or whether it should give an error at that > point. I think the compiler should not ignore the ill-formed declaration because 1) the diagnostic emitted is just a warning and 2) acknowledging the declaration even though it is ill-formed is consistent with the behavior of the following test case: namespace A { extern "C" void foo (int); } namespace B { extern "C" void foo (); } int main () { B::foo (); } $ g++ -c exc.c exc.C:9:29: warning: declaration of ‘void B::foo(int)’ with C language linkage [enabled by default] extern "C" void foo (int); ^ exc.C:3:21: warning: conflicts with previous declaration ‘void A::foo()’ [enabled by default] extern "C" void foo (); ^ Here, a much more egregious bug may have been introduced yet the the second ill-formed declaration is still usable.