This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: maybe GCC C++ bug in namespace handling?
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Dirk Mueller <dmuell at gmx dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: 21 Feb 2002 20:31:11 -0300
- Subject: Re: maybe GCC C++ bug in namespace handling?
- Organization: GCC Team, Red Hat
- References: <20020211214740.A19214@rotes20.wohnheim.uni-kl.de>
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