11546 – [3.3 Regression] Type lookup problems in out-of-line definition of a class doubly nested from a template class (original) (raw)

Description Benjamin S. Scarlet 2003-07-16 13:08:39 UTC

The following code does not compile as expected:

template class A { public: class B; };

template class A::B { public: class C; };

template class A::B::C { public: A &a; };

I originally tried with the redhat 9 gcc-3.2, which ICE'd. I then followed up by downloading and compiling vanilla gcc-3.3 from ftp.gnu.org. With the g++ from that compile, the above code produces:

Foo.cpp:16: error: non-template type A' used as a template Foo.cpp:16: error: ISO C++ forbids declaration of a' with no type

Since A most definitely is a template, I think this is wrong. I've seen other weird behaviour with more complex examples, but this seems like a good starting point.