This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
namespace bug
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: namespace bug
- From: deb at pixar dot com (David Baraff)
- Date: Tue, 4 May 99 22:00 PDT
This program fails to compile, but is legal. Note that if
the we declare class Derived within namespace Foo, this compiles.
So the problem is using the style
class Foo::Derived
for declarations.
Reading specs from /usr/local/share/egcs/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.21/specs
gcc version egcs-2.93.21 19990502 (gcc2 ss-980929 experimental)
/usr/local/share/egcs/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.21/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=93 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) crap.cpp crap.ii
GNU CPP version egcs-2.93.21 19990502 (gcc2 ss-980929 experimental) (sparc)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/share/egcs/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.21/../../../../include/g++-2
/usr/local/include
/usr/local/share/egcs/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.21/../../../../sparc-sun-solaris2.6/include
/usr/local/share/egcs/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.21/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
/usr/local/share/egcs/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.21/cc1plus crap.ii -quiet -dumpbase crap.cc -version -o crap.s
GNU C++ version egcs-2.93.21 19990502 (gcc2 ss-980929 experimental) (sparc-sun-solaris2.6) compiled by GNU C version egcs-2.93.21 19990502 (gcc2 ss-980929 experimental).
crap.cpp:19: ANSI C++ forbids declaration `Derived' with no type
// ------------ crap.cpp: -------------
namespace Foo {
class Base;
template <class T> class Derived;
}
class Foo::Base {
public:
const int elementSize;
Base();
~Base();
};
template <class T>
class Foo::Derived : public Foo::Base {
public:
Derived()
{
}
};