Namespace 'using' at global scope, recently broken

Alexandre Oliva oliva@dcc.unicamp.br
Thu Aug 27 15:42:00 GMT 1998


Josh Stern <jstern@citilink.com> 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 {
[snip]
> }; }

> //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
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list