The following error occurs while compiling template code (included as error-4.2.2.ii at the tail of this report).
> $ g++ -c error-4.2.2.cc > error-4.2.2.cc: In constructor 'ClassC<DATATYPE>::ClassC()': > error-4.2.2.cc:35: internal compiler error: in stabilize_expr, at > cp/tree.c:2273 > Please submit a full bug report, > with preprocessed source if appropriate. > See <URL:http://gcc.gnu.org/bugs.html> for instructions. The same error occurs reliably on both Linux/Intel and Solaris/Sparc on Linux gcc -v produces: > Using built-in specs. > Target: i686-pc-linux-gnu > Configured with: ../gcc-4.2.2/configure --enable-languages=c,c++ > --prefix=/data/rosa2/build/gcc/ins-4.2.2-Linux-i686 > Thread model: posix > gcc version 4.2.2 On Solaris gcc -v produces: > Using built-in specs. > Target: sparc-sun-solaris2.8 > Configured with: ../gcc-4.2.2/configure > --prefix=/space/snail/gl17859/test-4.2.2/tools --with-threads=posix > --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --enable-shared > --with-cpu=v9 --enable-languages=c,c++ > Thread model: posix > gcc version 4.2.2 Note that the error does not occur with gcc 4.1.0: > Using built-in specs. > Target: i686-pc-linux-gnu > Configured with: ../gcc-4.0.1/configure --prefix=/tools/gcc-4.0.1 > --disable-shared --enable-threads=posix --disable-checking --with-system-zlib > --enable-__cxa_atexit --enable-languages=c,c++ > --enable-version-specific-runtime-libs > Thread model: posix > gcc version 4.0.1 == error-4.2.2.ii # 1 "error-4.2.2.cc" # 1 "<built-in>" # 1 "<command line>" # 1 "error-4.2.2.cc" class ClassA; template <class T> class SmartPtr { private: T* m_p; public: T& operator*() { return *m_p; } }; class ClassB { public: ClassB(const ClassA &); }; template <class DATATYPE> class ClassC { public: ClassC( ); private: SmartPtr<ClassA> m_xfr; }; template <class DATATYPE> ClassC<DATATYPE>::ClassC( ) { ClassB *sr = new ClassB(*m_xfr); } -- Summary: 4.2.2 internal error in stabilize_expr Product: gcc Version: 4.2.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gschrad at ll dot mit dot edu GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34336