https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71406
Bug ID: 71406 Summary: ICE on valid C++ code on x86_64-linux-gnu: in finish_class_member_access_expr, at cp/typeck.c:2782 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: --- The following code causes an ICE when compiled with the current gcc trunk on x86_64-linux-gnu in both 32-bit and 64-bit modes. This is a regression from 6.1.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 20160603 (experimental) [trunk revision 237059] (GCC) $ $ g++-6.1 -c small.cpp $ clang++ -c small.cpp $ $ g++-trunk -c small.cpp small.cpp: In member function ‘void A<T>::foo()’: small.cpp:4:35: internal compiler error: in finish_class_member_access_expr, at cp/typeck.c:2782 void foo () { this->A::template bar <>; } ^~~~~~ 0x7d85ac finish_class_member_access_expr(cp_expr, tree_node*, bool, int) ../../gcc-source-trunk/gcc/cp/typeck.c:2782 0x78d7a4 cp_parser_postfix_dot_deref_expression ../../gcc-source-trunk/gcc/cp/parser.c:7331 0x78afec cp_parser_postfix_expression ../../gcc-source-trunk/gcc/cp/parser.c:6934 0x78990c cp_parser_unary_expression ../../gcc-source-trunk/gcc/cp/parser.c:7986 0x7937c7 cp_parser_cast_expression ../../gcc-source-trunk/gcc/cp/parser.c:8663 0x793dc5 cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8765 0x7946b0 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9053 0x796fa9 cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9220 0x7975cf cp_parser_expression_statement ../../gcc-source-trunk/gcc/cp/parser.c:10681 0x7a640b cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10532 0x7a70cc cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10804 0x7a71bf cp_parser_compound_statement ../../gcc-source-trunk/gcc/cp/parser.c:10758 0x7a736f cp_parser_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20696 0x7a736f cp_parser_ctor_initializer_opt_and_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20732 0x7a7e11 cp_parser_function_definition_after_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25416 0x7abc30 cp_parser_late_parsing_for_member ../../gcc-source-trunk/gcc/cp/parser.c:26256 0x787439 cp_parser_class_specifier_1 ../../gcc-source-trunk/gcc/cp/parser.c:21570 0x787439 cp_parser_class_specifier ../../gcc-source-trunk/gcc/cp/parser.c:21596 0x787439 cp_parser_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:15836 0x79b843 cp_parser_decl_specifier_seq ../../gcc-source-trunk/gcc/cp/parser.c:12758 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. $ -------------------------------------------- template < typename T > struct A : T { void foo () { this->A::template bar <>; } };