This is the mail archive of the gcc-bugs@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]

namespace bug


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()
    {
    }
};


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