The following code: // START of CODE, FILE 'try.cpp' template<class A,class B> typeof(A(0)+B(0)) add( A a , B b ) { return a + b; } void f( double & S , double X , int Y ) { S = add( X , Y ); } // END OF CODE causes g++ to emit an ICE error, as shown of the following sessions transcript. I joined the try.ii file even if I think it can be easily re-created, as the bug-triggering code contains non "#include<...>" statement. ----------------------------------------------------------------------------------------- > gcc -v -save-temps try.cpp Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) /usr/lib/gcc/i486-linux-gnu/4.1.2/cc1plus -E -quiet -v -D_GNU_SOURCE try.cpp -mtune=i686 -fpch-preprocess -o try.ii ignoring nonexistent directory "/usr/local/include/i486-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../i486-linux-gnu/include" ignoring nonexistent directory "/usr/include/i486-linux-gnu" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2 /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward /usr/local/include /usr/lib/gcc/i486-linux-gnu/4.1.2/include /usr/include End of search list. /usr/lib/gcc/i486-linux-gnu/4.1.2/cc1plus -fpreprocessed try.ii -quiet -dumpbase try.cpp -mtune=i686 -auxbase try -version -o try.s GNU C++ version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) (i486-linux-gnu) compiled by GNU C version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21). GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64575 Compiler executable checksum: 183d42a838ed2b7313bffcb8f2f2fda7 try.cpp: In function '__typeof__ (((A)(0) + (B)(0))) add(A, B) [with A = double, B = int]': try.cpp:4: internal compiler error: in write_type, at cp/mangle.c:1651 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>. Preprocessed source stored into /tmp/ccAaaM0z.out file, please attach this to your bugreport. ----------------------------------------------------------------------------------------- > cat try.ii # 1 "try.cpp" # 1 "<built-in>" # 1 "<command line>" # 1 "try.cpp" template<class A,class B> typeof(A(0)+B(0)) add( A a , B b ) { return a + b; } void f( double & S , double X , int Y ) { S = add( X , Y ); } -----------------------------------------------------------------------------------------
*** This bug has been marked as a duplicate of 13740 ***