http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58648

            Bug ID: 58648
           Summary: [c++11] ICE with variadic template
           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 valid code snippet (compiled with "-std=c++11") triggers an ICE
since GCC 4.4.0:

====================================================
template<int, typename...T, T...> int foo();

int i = foo<0>();
====================================================

bug.cc:3:16: internal compiler error: tree check: accessed elt 2 of tree_vec
with 1 elts in tsubst_pack_expansion, at cp/pt.c:9535
 int i = foo<0>();
                ^
0xce3195 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9361
0x5a9fad tree_vec_elt_check
        ../../gcc/gcc/tree.h:2799
0x5a9fad tsubst_pack_expansion
        ../../gcc/gcc/cp/pt.c:9535
0x5aac77 coerce_template_parameter_pack
        ../../gcc/gcc/cp/pt.c:6514
0x5aac77 coerce_template_parms
        ../../gcc/gcc/cp/pt.c:6776
0x5d1493 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../gcc/gcc/cp/pt.c:15301
0x53e9bc add_template_candidate_real
        ../../gcc/gcc/cp/call.c:2923
0x53a739 add_template_candidate
        ../../gcc/gcc/cp/call.c:3020
0x53a739 add_candidates
        ../../gcc/gcc/cp/call.c:5075
0x541867 perform_overload_resolution
        ../../gcc/gcc/cp/call.c:3816
0x5481da build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
        ../../gcc/gcc/cp/call.c:3893
0x6b4dce finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc/gcc/cp/semantics.c:2257
0x6417e6 cp_parser_postfix_expression
        ../../gcc/gcc/cp/parser.c:6009
0x64412d cp_parser_unary_expression
        ../../gcc/gcc/cp/parser.c:7009
0x644cff cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:7701
0x6451bf cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:7937
0x645616 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:7987
0x645616 cp_parser_constant_expression
        ../../gcc/gcc/cp/parser.c:8197
0x6513be cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16530
0x65198f cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10995
Please submit a full bug report, [etc.]

Reply via email to