ICE on code that is missing a 'typename'. Inclding the 'typename' obviates the problem. The program is small: // Compiling this program causes an internal_compilation_error. The // program is missing a 'typename'. Compiling with '-DAVOID_ERROR' // causes the missing 'typename' to be included and the compilation // succeeds. #include <vector> template<class T> struct CreateLeaf {}; template<class T> struct CreateLeaf<std::vector<T> > { #ifdef AVOID_ERROR typedef typename std::vector<T>::const_iterator Leaf_t; #else // erroneous typedef std::vector<T>::const_iterator Leaf_t; #endif // AVOID_ERROR }; Release: head Environment: Red Hat Linux release 7.2 (Enigma) i686-pc-linux-gnu) How-To-Repeat: /home/oldham/gcc-install/gcc1/lib/gcc-lib/i686-pc-linux-gnu/3.4/cc1plus -fpreprocessed goo.ii -quiet -dumpbase goo.C -auxbase goo -Wall -pedantic -version -o goo.s
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. Fallout from the implicit typename deprecation. Here's a similar snippet, which I think is even legal since we don't instantiate for a particular value of T (well, legal except for the missing typename, of course): ----------------------------------- template<typename T, typename A> struct X { typedef typename A::template foo<T>::type type; }; template<typename T, typename = int> struct Y { typedef double type; typename X<T,T>::type t; }; template<class T> struct Z { typedef Y<T>::type type; }; ------------------------- g/a> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.ii x.ii: In instantiation of `Y<T, int>': x.ii:12: instantiated from here x.ii:7: error: `Y<T, <anonymous template type parameter> >::t' has incomplete type x.ii:7: internal compiler error: in cxx_incomplete_type_diagnostic, at cp/typeck2.c:278 Please submit a full bug report, with preprocessed source if appropriate. Since an ICE is worse than an error message, I rate this as a regression. It gave warnings about the implicit typename stuff with 3.3 and 3.2.2, and worked with 2.95 W.
Fixed on the mainline (20030525), already (in fact this might be a duplicate): [omni:~/src/gccPRs] pinskia% /Volumes/UFS_Partition/pinskia/fsf/bin/g++ pr9464.cc pr9464.cc:13: error: type `Y<T, int>' is not derived from type `Z<T>' pr9464.cc:13: error: ISO C++ forbids declaration of `type' with no type pr9464.cc:13: error: expected `;'