http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56247
Bug #: 56247 Summary: internal compiler error: in tsubst_copy, at cp/pt.c:12131 Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: dsaga...@gmail.com Created attachment 29392 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29392 Test case ICE when the same member function pointer (to a base class's method) is used as a template parameter from two different methods of the same templated child class. What's a bit unusual here is that the bug is only triggered if the same instantiation occurs in two different methods. The reduced test case is short enough to include directly: -------- struct Base { void method() {} }; typedef void (Base::*MemPtr)(); // Template with a member function pointer "non-type parameter". template<MemPtr func> struct Wrapper {}; template<class C> struct Child : public Base { // Templated derived class instantiates the Wrapper with the same parameter // in two different virtual methods. void foo() { typedef Wrapper<&Base::method> W; } void bar() { typedef Wrapper<&Base::method> W; } }; // Instantiate Child with some type. template class Child<int>; -------- Here's the detailed gcc output: % /usr/local/bin/g++47 -v -save-temps -c bugtest.cc Using built-in specs. COLLECT_GCC=/usr/local/bin/g++47 Target: x86_64-portbld-freebsd8.2 Configured with: ./../gcc-4.7-20120818/configure --disable-nls --enable-languages=c,c++,objc,fortran --libdir=/usr/local/lib/gcc47 --libexecdir=/usr/local/libexec/gcc47 --program-suffix=47 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc47/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --enable-languages=c,c++,objc,fortran,java --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc47 --build=x86_64-portbld-freebsd8.2 Thread model: posix gcc version 4.7.2 20120818 (prerelease) (FreeBSD Ports Collection) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/cc1plus -E -quiet -v src/scratch/bugtest.cc -mtune=generic -march=x86-64 -fpch-preprocess -o bugtest.ii ignoring nonexistent directory "/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/../../../../../x86_64-portbld-freebsd8.2/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc47/include/c++/ /usr/local/lib/gcc47/include/c++//x86_64-portbld-freebsd8.2 /usr/local/lib/gcc47/include/c++//backward /usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/include /usr/local/include /usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd8.2/4.7.2/cc1plus -fpreprocessed bugtest.ii -quiet -dumpbase bugtest.cc -mtune=generic -march=x86-64 -auxbase bugtest -version -o bugtest.s GNU C++ (FreeBSD Ports Collection) version 4.7.2 20120818 (prerelease) (x86_64-portbld-freebsd8.2) compiled by GNU C version 4.7.2 20120818 (prerelease), GMP version 5.0.1, MPFR version 3.0.0, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++ (FreeBSD Ports Collection) version 4.7.2 20120818 (prerelease) (x86_64-portbld-freebsd8.2) compiled by GNU C version 4.7.2 20120818 (prerelease), GMP version 5.0.1, MPFR version 3.0.0, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 4c5936a9f1a6230b2e84e5f997572e48 src/scratch/bugtest.cc: In instantiation of 'void Child<C>::bar() [with C = int]': src/scratch/bugtest.cc:21:16: required from here src/scratch/bugtest.cc:17:49: internal compiler error: in tsubst_copy, at cp/pt.c:12131 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.