https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77509
Bug ID: 77509 Summary: ICE on invalid C++ code: in finish_class_member_access_expr, at cp/typeck.c:2783 Product: gcc Version: 7.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: --- It affects all versions 4.8.x and later, and is a regression from 4.7.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/7.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 7.0.0 20160906 (experimental) [trunk revision 240004] (GCC) $ $ g++-trunk -c small.cpp small.cpp:3:8: warning: direct base ‘A’ inaccessible in ‘C’ due to ambiguity struct C : A, B {}; ^ small.cpp: In function ‘void foo()’: small.cpp:8:8: internal compiler error: in finish_class_member_access_expr, at cp/typeck.c:2783 c.C::m < int > (); ^~~~~~~~~ 0x7e8254 finish_class_member_access_expr(cp_expr, tree_node*, bool, int) ../../gcc-source-trunk/gcc/cp/typeck.c:2783 0x79dd04 cp_parser_postfix_dot_deref_expression ../../gcc-source-trunk/gcc/cp/parser.c:7364 0x79b54c cp_parser_postfix_expression ../../gcc-source-trunk/gcc/cp/parser.c:6967 0x799e6c cp_parser_unary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8019 0x7a3d17 cp_parser_cast_expression ../../gcc-source-trunk/gcc/cp/parser.c:8696 0x7a4315 cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8798 0x7a4c00 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9086 0x7a74f9 cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9253 0x7a7b1f cp_parser_expression_statement ../../gcc-source-trunk/gcc/cp/parser.c:10736 0x7b645c cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10587 0x7b73dc cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10859 0x7b74cf cp_parser_compound_statement ../../gcc-source-trunk/gcc/cp/parser.c:10813 0x7b767f cp_parser_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20832 0x7b767f cp_parser_ctor_initializer_opt_and_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20868 0x7b8121 cp_parser_function_definition_after_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25565 0x7b8e35 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25477 0x7b8e35 cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:18603 0x7b9189 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12495 0x7b94c1 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12363 0x7c22a0 cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12260 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. $ ------------------------------------------------- struct A { template < class > void m (); }; struct B : A {}; struct C : A, B {}; void foo () { C c; c.C::m < int > (); }