Compiling a .cpp file with the following contents triggers an internal compiler error: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
struct Base { template<class C> void method() { } }; struct Left : public Base { }; struct Right : public Base { }; struct Join : public Left, public Right { }; void function() { Join join; join.Base::method<int>(); join.Left::method<int>(); } >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Issued command-line: g++ -Wall -W -Wundef -Wpointer-arith -g -O0 -c -o /dev/null bug.cpp Resulting output: bug.cpp: In function 'void function()': bug.cpp:13: internal compiler error: in build_base_path, at cp/class.c:273 Please submit a full bug report, ... The error does not occur if structs Left and Right inherit virtually from Base; that is, "struct Left : virtual public Base { };" and similarly for Right. The same error occurs with gcc-3.4.3, the only difference being that the relevant line number in cp/class.cp is 275. Full output from running with "-v --save-temps" is as follows: g++ -v -save-temps -Wall -W -Wundef -Wpointer-arith -g -O0 -c -o /dev/null bug.cpp >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.1.1/configure --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ Thread model: posix gcc version 4.1.1 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.1.1/cc1plus -E -quiet -v -D_GNU_SOURCE bug.cpp -mtune=pentiumpro -Wall -W -Wundef -Wpointer-arith -fworking-directory -O0 -fpch-preprocess -o bug.ii ignoring nonexistent directory "NONE/include" ignoring nonexistent directory "/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1 /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/i686-pc-linux-gnu /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/backward /usr/local/include /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.1/include /usr/include End of search list. /usr/local/libexec/gcc/i686-pc-linux-gnu/4.1.1/cc1plus -fpreprocessed bug.ii -quiet -dumpbase bug.cpp -mtune=pentiumpro -auxbase-strip /dev/null -g -O0 -Wall -W -Wundef -Wpointer-arith -version -o bug.s GNU C++ version 4.1.1 (i686-pc-linux-gnu) compiled by GNU C version 4.1.1. GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=63424 Compiler executable checksum: 5c1ee95ea2451a4e1aafd30c10a207cb bug.cpp: In function 'void function()': bug.cpp:13: internal compiler error: in build_base_path, at cp/class.c:273 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Contents of bug.ii: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # 1 "bug.cpp" # 1 "/home/raymond/tmp//" # 1 "<built-in>" # 1 "<command line>" # 1 "bug.cpp" struct Base { template<class C> void method() { } }; struct Left : public Base { }; struct Right : public Base { }; struct Join : public Left, public Right { }; void function() { Join join; join.Base::method<int>(); join.Left::method<int>(); } >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -- Summary: Multiple-inheritance code triggers "internal compiler error: in build_base_path, at cp/class.c:273" Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: raymond at corvil dot com 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=29080