--- Output from "g++ -v -save-temps ice.cc"-----------------: 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 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) /usr/lib/gcc/i486-linux-gnu/4.1.2/cc1plus -E -quiet -v -D_GNU_SOURCE ice.cc -mtune=generic -fpch-preprocess -o ice.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 ice.ii -quiet -dumpbase ice.cc -mtune=generic -auxbase ice -version -fstack-protector -fstack-protector -o ice.s GNU C++ version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) (i486-linux-gnu) compiled by GNU C version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129273 Compiler executable checksum: aca0f1fd158b16191964d93038d65dbf ice.cc: In member function void ICE::aj(): ice.cc:27: internal compiler error: in value_dependent_expression_p, at cp/pt.c:12550 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/cc3765Eq.out file, please attach this to your bugreport.
--- /tmp/cc3765Eq.out ---------------------------------: // /usr/lib/gcc/i486-linux-gnu/4.1.2/cc1plus -fpreprocessed ice.ii -quiet -dumpbase ice.cc -mtune=generic -auxbase ice -version -fstack-protector -fstack-protector -o - -frandom-seed=0 # 1 "ice.cc" # 1 "<built-in>" # 1 "<command line>" # 1 "ice.cc" class Dummy { public: int operator&(signed int &) { return 4; } int test(signed int test) { return 4; } }; class ICE { public: template <typename T> void aj(void) { signed int kalle = 9; int size = Dummy() & kalle; char buffer[size]; } }; --- Original code ---------------------------------------: class Dummy { public: int operator&(signed int &) { return 4; } int test(signed int test) { return 4; } }; class ICE { public: template <typename T> void aj(void) { signed int kalle = 9; #if 0 // this compiles fine... int size = Dummy().operator&(kalle); #else // this generates an ICE... int size = Dummy() & kalle; #endif // if commented out, no ICE... char buffer[size]; } }; Cheers, Lars -- Summary: Internal Compiler Error when using operator& from template function Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: larsand at gmail dot com GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31064