Namespace 'using' at global scope, recently broken

Alexandre Oliva
Thu Aug 27 15:42:00 GMT 1998

Josh Stern <> writes:

> Simple attempts at namespace 'using' directives with global
> scope mis-fire with the 08-24 snapshot.

The snapshot is correct.  You can't redefine the meaning of a type
name, see [namespace.udecl]/10.

> #include <X11/Xlib.h>
[defines struct ::Display]

> namespace Some { class Display {
> }; }

> //using namespace Some;  // doesn't work
> using Some::Display;  // doesn't work

> int doSomething() {
>   //  using Some::Display;  // works!

Since now you're in a different scope, the using declaration can hide
the declaration from the outer scope.

Alexandre Oliva
Universidade Estadual de Campinas, SP, Brasil

More information about the Gcc-bugs mailing list