http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58535
Bug ID: 58535
Summary: [4.8/4.9 Regression] ICE with virtual template
function
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
The following invalid code snippet triggers an ICE since GCC 4.8.0:
======================================
struct A
{
template<int> virtual void foo();
};
======================================
bug.cc:3:17: error: templates may not be 'virtual'
template<int> virtual void foo();
^
bug.cc:3:35: internal compiler error: in check_member_template, at
cp/decl2.c:510
template<int> virtual void foo();
^
0x605d1b check_member_template(tree_node*)
../../gcc/gcc/cp/decl2.c:509
0x57f77f finish_member_template_decl(tree_node*)
../../gcc/gcc/cp/pt.c:290
0x64d574 cp_parser_template_declaration_after_export
../../gcc/gcc/cp/parser.c:22459
0x62d222 cp_parser_member_declaration
../../gcc/gcc/cp/parser.c:19698
0x62e236 cp_parser_member_specification_opt
../../gcc/gcc/cp/parser.c:19625
0x62e236 cp_parser_class_specifier_1
../../gcc/gcc/cp/parser.c:18880
0x630b90 cp_parser_class_specifier
../../gcc/gcc/cp/parser.c:19096
0x630b90 cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:14080
0x6461ad cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:11328
0x64a189 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:10918
0x64c190 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:10867
0x6551ae cp_parser_declaration
../../gcc/gcc/cp/parser.c:10764
0x653f0d cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:10650
0x6557e6 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:3939
0x6557e6 c_parse_file()
../../gcc/gcc/cp/parser.c:28893
0x768164 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]
A c++1y variant crashes (on trunk) without an error message before the ICE:
======================================
struct A
{
virtual void foo(auto);
};
======================================