Bug 60064 - [c++1y] ICE with auto as parameter of friend function
Summary: [c++1y] ICE with auto as parameter of friend function
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2014-02-04 20:47 UTC by Volker Reichelt
Modified: 2014-02-19 15:44 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.9.0
Last reconfirmed: 2014-02-18 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2014-02-04 20:47:06 UTC
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.]
Comment 1 Marek Polacek 2014-02-18 09:23:24 UTC
Started ICEing with r202540, the disappeared with revert in r202570, then started ICEing again with r202612.
Comment 2 Adam Butcher 2014-02-18 22:30:27 UTC
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
Comment 3 Volker Reichelt 2014-02-19 15:44:37 UTC
Fixed with Adam's patch.