The attached (very small) source file causes an ICE when compiled. It defines two class templates, A and B, then tries to define class C as an inner class of B, inheriting from A. However, the definition of B does not include a declaration of C. Deleting the inheritance from A allows the compiler to correctly output this error: failure.cxx:17: invalid definition of qualified type `B<T>::C' failure.cxx:17: `struct B<T>::<anonymous>' does not declare a template type Uncommenting the declaration of C in B produces legal code, which the compiler compiles without trouble. Release: gcc version 3.2.1 Environment: g++ -v: Reading specs from /users/nf50041/lib/gcc-lib/sparc-sun-solaris2.8/3.2.1/specs Configured with: ../gcc-3.2.1-original/configure --prefix=/users/nf50041 --with-gnu-as --with-gnu-ld --enable-languages=c,c++ Thread model: posix gcc version 3.2.1 Also using binutils-2.13.1; uname -a gives: SunOS waverley 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-5_10 and the architecture is (Ultra) sparc32. How-To-Repeat: Run: g++ -c failure.cxx and you should get: failure.cxx:17: internal error: Segmentation Fault
Fix: None known (write legal code :-)
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. The code ICEs with 3.0, 3.2 and 3.3. It produced a useful error with 2.95, and with present 3.4. Here's the code, for simpler cut-n-pasting: ----------------------- template<typename T> class A {}; template<typename T> class B {}; template<typename T> class B<T>::C : public A<T> {}; ----------------------- W.
*** This bug has been marked as a duplicate of 5754 ***