"g++ -c code.i" works, "g++ -c -g code.i" gives tmp/code.i: In instantiation of 'Foo_impl<int (Bar::*)()const>::Helper': tmp/code.i:19:27: instantiated from 'void Foo_impl<R (O::*)()const>::do_something() [with R = int, O = Bar]' tmp/code.i:34:1: instantiated from here tmp/code.i:13:5: internal compiler error: Segmentation fault
This is a regression against g++ 4.4.x. Replacing Some_type by int works. An empty body for do_something() works as well. g++ -v: Using built-in specs. COLLECT_GCC=/some/prefix/gcc-4.5.0/x86_64-unknown-linux-gnu/bin/g++ COLLECT_LTO_WRAPPER=/some/prefix/gcc-4.5.0/x86_64-unknown-linux-gnu/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/some/prefix/gcc-4.5.0 --exec-prefix=/some/prefix/gcc-4.5.0/x86_64-unknown-linux-gnu --enable-version-specific-runtime-libs --enable-stage1-checking --disable-nls --with-system-zlib --enable-multilib --enable-languages=c,c++,objc --with-gmp-include=/some/prefix/gmp-4.2.2/x86_64-unknown-linux-gnu/include --with-gmp-lib=/some/prefix/gmp-4.2.2/x86_64-unknown-linux-gnu/lib --with-mpfr-include=/some/prefix/mpfr-2.4.2/include --with-mpfr-lib=/some/prefix/mpfr-2.4.2/x86_64-unknown-linux-gnu/lib --with-mpc-include=/some/prefix/mpc-0.8.1/include --with-mpc-lib=/some/prefix/mpc-0.8.1/x86_64-unknown-linux-gnu/lib --with-gnu-as --with-as=/some/prefix/binutils-2.20.1/x86_64-unknown-linux-gnu/bin/as --with-gnu-ld --with-ld=/some/prefix/binutils-2.20.1/x86_64-unknown-linux-gnu/bin/ld Thread model: posix gcc version 4.5.0 (GCC) -- Summary: ICE with -g Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: joachim dot reichel at gmx dot de GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43868