This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: maybe GCC C++ bug in namespace handling?


On Feb 11, 2002, Dirk Mueller <dmuell@gmx.net> wrote:

> class derived : public ns::base {
> public:
>   virtual void foo();
> };

> void derived::foo()
> {
>   base::foo(); // or ns::base::foo ?
> }

> gcc groks both without a warning or an error, while other compilers only
> accept the second variant. 

I think GCC is right in accepting it.  The name of a class is inserted
in its own namespace, and thus it's inherited by derived classes.
Therefore, looking up `base' in `derived' should find ns::base, and it
apparently does.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]