This is a regression from 6.2. $ 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++-6.2 small.cpp $ clang++ small.cpp $ $ g++-trunk small.cpp small.cpp: In member function ‘void B<T>::g()’: small.cpp:10:23: internal compiler error: in finish_class_member_access_expr, at cp/typeck.c:2783 this->B::template f < &B < T >::g > (); ^~~~~~~~~~~~~~~~~ 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 0x7bbf80 cp_parser_late_parsing_for_member ../../gcc-source-trunk/gcc/cp/parser.c:26446 0x796d56 cp_parser_class_specifier_1 ../../gcc-source-trunk/gcc/cp/parser.c:21719 0x798679 cp_parser_class_specifier ../../gcc-source-trunk/gcc/cp/parser.c:21745 0x798679 cp_parser_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:15971 0x7abdf3 cp_parser_decl_specifier_seq ../../gcc-source-trunk/gcc/cp/parser.c:12889 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 { template < void (T::*Fn) () > void f () {} }; template < typename T > struct B : A < B < T > > { void g () { this->B::template f < &B < T >::g > (); } }; int main () { B < int > b; b.g (); return 0; }
Confirmed, started with r236221.
I think this is related/dup of Bug 71710 -- we ICE on gcc_assert (identifier_p (name) too, and it's caused by the same revision.
Looks like my in-testing 71406 patch also gets this one ...
Author: nathan Date: Mon Jan 23 20:19:07 2017 New Revision: 244832 URL: https://gcc.gnu.org/viewcvs?rev=244832&root=gcc&view=rev Log: PR c++/71406 - ICE with scope-ref'd template id exprs PR c++/77508 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF before breaking up TEMPLATE_ID_EXPR. PR c++/71406 PR c++/77508 * g++.dg/template/pr71406.C: New. Added: trunk/gcc/testsuite/g++.dg/template/pr71406.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck.c trunk/gcc/testsuite/ChangeLog
Fixed r244832.