[Bug c++/60219] New: [4.8/4.9 Regression] [c++11] ICE invalid use of variadic template
reichelt at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Feb 15 22:58:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60219
Bug ID: 60219
Summary: [4.8/4.9 Regression] [c++11] ICE invalid use of
variadic template
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: diagnostic, ice-on-invalid-code
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 (compiled with "-std=c++11") triggers
an ICE since GCC 4.8.0:
=============================================
template<typename..., int> void foo();
void bar()
{
foo<0>;
}
=============================================
bug.cc: In function 'void bar()':
bug.cc:5:9: internal compiler error: tree check: accessed elt 3 of tree_vec
with 2 elts in coerce_template_parms, at cp/pt.c:6857
foo<0>;
^
0xdca805 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
../../gcc/gcc/tree.c:9377
0x61aa12 tree_vec_elt_check
../../gcc/gcc/tree.h:2899
0x61aa12 coerce_template_parms
../../gcc/gcc/cp/pt.c:6857
0x633577 resolve_nondeduced_context(tree_node*)
../../gcc/gcc/cp/pt.c:16561
0x6f9907 convert_to_void(tree_node*, impl_conv_void, int)
../../gcc/gcc/cp/cvt.c:1244
0x726d8a finish_expr_stmt(tree_node*)
../../gcc/gcc/cp/semantics.c:684
0x6ae3e8 cp_parser_statement
../../gcc/gcc/cp/parser.c:9473
0x6af1b9 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:9745
0x6af326 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:9699
0x6c34fb cp_parser_function_body
../../gcc/gcc/cp/parser.c:18641
0x6c34fb cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:18677
0x6c7842 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:22792
0x6c86e1 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:22704
0x6c86e1 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:16585
0x6c9979 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:11205
0x6acc63 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:11086
0x6d3f12 cp_parser_declaration
../../gcc/gcc/cp/parser.c:10983
0x6d2c08 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:10869
0x6d44aa cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4014
0x6d44aa c_parse_file()
../../gcc/gcc/cp/parser.c:31536
Please submit a full bug report, [etc.]
If I actually try to call foo<0>, I get a broken diagnostic ending in a colon:
==============================================
template<typename..., int> void foo();
void bar()
{
foo<0>();
}
==============================================
bug.cc: In function 'void bar()':
bug.cc:5:10: error: no matching function for call to 'foo()'
foo<0>();
^
bug.cc:5:10: note: candidate is:
bug.cc:1:33: note: template<class ..., int <anonymous> > void foo()
template<typename..., int> void foo();
^
bug.cc:1:33: note: template argument deduction/substitution failed:
Why?
More information about the Gcc-bugs
mailing list