The following valid code snippet (compiled with "-std=c++1y") triggers an ICE on trunk: =========================================== struct A { friend void foo(auto) {} }; =========================================== bug.cc:4:1: internal compiler error: in poplevel_class, at cp/name-lookup.c:2951 }; ^ 0x77ff17 poplevel_class() ../../gcc/gcc/cp/name-lookup.c:2951 0x665008 popclass() ../../gcc/gcc/cp/class.c:7127 0x679edd finish_struct(tree_node*, tree_node*) ../../gcc/gcc/cp/class.c:6808 0x6ac14a cp_parser_class_specifier_1 ../../gcc/gcc/cp/parser.c:19218 0x6ac14a cp_parser_class_specifier ../../gcc/gcc/cp/parser.c:19437 0x6ac14a cp_parser_type_specifier ../../gcc/gcc/cp/parser.c:14302 0x6c5540 cp_parser_decl_specifier_seq ../../gcc/gcc/cp/parser.c:11547 0x6cc139 cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:11137 0x6af5f3 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:11086 0x6d68f2 cp_parser_declaration ../../gcc/gcc/cp/parser.c:10983 0x6d55e8 cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:10869 0x6d6eca cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:4014 0x6d6eca c_parse_file() ../../gcc/gcc/cp/parser.c:31528 0x7f6973 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1060 Please submit a full bug report, [etc.]
Started ICEing with r202540, the disappeared with revert in r202570, then started ICEing again with r202612.
Author: abutcher Date: Tue Feb 18 22:29:56 2014 New Revision: 207856 URL: http://gcc.gnu.org/viewcvs?rev=207856&root=gcc&view=rev Log: Fix PR c++/60064. PR c++/60064 * parser.c (cp_parser_member_declaration): Pop fully implicit template scope for generic friend declarations as well as for non-friends. PR c++/60064 * g++.dg/cpp1y/pr60064.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60064.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
Fixed with Adam's patch.