https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70202
Bug ID: 70202 Summary: ICE on invalid code on x86_64-linux-gnu in build_simple_base_path, at cp/class.c:579 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following code causes an ICE when compiled with the current GCC trunk on x86_64-linux-gnu. It also seems to affect all earlier versions of GCC since as early as 4.4.x. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 6.0.0 20160311 (experimental) [trunk revision 234134] (GCC) $ $ g++-trunk small.cpp small.cpp:6:21: error: duplicate base type ‘A’ invalid class B : public A, A ^ small.cpp: In function ‘int main()’: small.cpp:13:5: error: aggregate ‘B b1’ has incomplete type and cannot be defined B b1, &b2 = b1; ^~ small.cpp:14:9: internal compiler error: in build_simple_base_path, at cp/class.c:579 A a = b2; ^~ 0x6d5c82 build_simple_base_path ../../gcc-source-trunk/gcc/cp/class.c:579 0x6f273d build_base_path(tree_code, tree_node*, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/class.c:409 0x6149e5 convert_like_real ../../gcc-source-trunk/gcc/cp/call.c:6568 0x613978 convert_like_real ../../gcc-source-trunk/gcc/cp/call.c:6538 0x610c3f build_over_call ../../gcc-source-trunk/gcc/cp/call.c:7493 0x61d3a5 build_new_method_call_1 ../../gcc-source-trunk/gcc/cp/call.c:8410 0x61d3a5 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int) ../../gcc-source-trunk/gcc/cp/call.c:8480 0x61e349 build_special_member_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/call.c:8017 0x786510 ocp_convert(tree_node*, tree_node*, int, int, int) ../../gcc-source-trunk/gcc/cp/cvt.c:887 0x7952a5 expand_default_init ../../gcc-source-trunk/gcc/cp/init.c:1689 0x7952a5 expand_aggr_init_1 ../../gcc-source-trunk/gcc/cp/init.c:1858 0x795be4 build_aggr_init(tree_node*, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/init.c:1606 0x62ef8a build_aggr_init_full_exprs ../../gcc-source-trunk/gcc/cp/decl.c:5964 0x62ef8a check_initializer ../../gcc-source-trunk/gcc/cp/decl.c:6108 0x658a0c cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc-source-trunk/gcc/cp/decl.c:6783 0x751a4f cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:18644 0x752200 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12365 0x752511 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12234 0x752f68 cp_parser_declaration_statement ../../gcc-source-trunk/gcc/cp/parser.c:11846 0x73162b cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10528 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ --------------------------------- class A { virtual void foo () { } }; class B : public A, A { }; int main () { B b1, &b2 = b1; A a = b2; return 0; }