https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71164

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduces test-case:

template <char, class Preconditioner> class A {
  template <class = Preconditioner> void m_fn1() { m_fn1(); }
};

g++ bug.cc -c -std=c++11
bug.cc: In substitution of ‘template<char <anonymous>, class Preconditioner>
template<class> void A<<anonymous>, Preconditioner>::m_fn1() [with
<template-parameter-2-1> = <missing>; char <anonymous> = <missing>;
Preconditioner = <missing>]’:
bug.cc:2:58:   required from here
bug.cc:2:13: internal compiler error: tree check: accessed elt 2 of tree_vec
with 1 elts in tsubst, at cp/pt.c:12961
   template <class = Preconditioner> void m_fn1() { m_fn1(); }
             ^~~~~
0x10052c5 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
        ../../gcc/tree.c:9950
0x716ef9 tree_vec_elt_check(tree_node const*, int, char const*, int, char
const*)
        ../../gcc/tree.h:3472
0x6de00a tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:12961
0x6fa535 type_unification_real
        ../../gcc/cp/pt.c:18488
0x7080aa fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../gcc/cp/pt.c:17753
0x66ddd0 add_template_candidate_real
        ../../gcc/cp/call.c:3110
0x66eb2c add_template_candidate
        ../../gcc/cp/call.c:3188
0x66eb2c add_candidates
        ../../gcc/cp/call.c:5361
0x66f3af build_new_method_call_1
        ../../gcc/cp/call.c:8312
0x66f3af build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc/cp/call.c:8511
0x784522 cp_parser_postfix_expression
        ../../gcc/cp/parser.c:6875
0x78205c cp_parser_unary_expression
        ../../gcc/cp/parser.c:7986
0x78c097 cp_parser_cast_expression
        ../../gcc/cp/parser.c:8663
0x78c65b cp_parser_binary_expression
        ../../gcc/cp/parser.c:8764
0x78cf20 cp_parser_assignment_expression
        ../../gcc/cp/parser.c:9051
0x78f84a cp_parser_expression
        ../../gcc/cp/parser.c:9220
0x78fdf3 cp_parser_expression_statement
        ../../gcc/cp/parser.c:10681
0x79f156 cp_parser_statement
        ../../gcc/cp/parser.c:10532
0x79fb3c cp_parser_statement_seq_opt
        ../../gcc/cp/parser.c:10804
0x79fc4f cp_parser_compound_statement
        ../../gcc/cp/parser.c:10758

While GCC 5.3.1 (g++ bug.cc -std=c++11 -c) works fine.

Martin

Reply via email to