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

            Bug ID: 78514
           Summary: ICE in tsubst, at cp/pt.c:13073
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org
  Target Milestone: ---

[forwarded from https://bugs.debian.org/845493]

seen with 4.8.5, 4.9.4, the 5 and 6 branches, and trunk r242638

$ cat index-sequence.cpp 
typedef long unsigned a;
template <bool, typename> struct b;
template <typename p> struct b<true, p> { typedef p c; };
template <bool d, typename p = void> using e = typename b<d, p>::c;
template <typename f, f...> struct g;
template <typename> struct h;
template <typename f, f... i> struct h<g<f, i...>> { using c = g<f, i...>; };
template <typename> struct j;
template <typename f, f... i> struct j<g<f, i...>> {
  using c = g<f, sizeof...(i)>;
};
template <typename f, f, typename = void> struct k;
template <typename f, f l> struct k<f, l, e<l == 0>> { using c = g<f>; };
template <typename f, f l> struct k<f, l, e<l && l % 2 == 0>> {
  using c = typename h<typename k<f, l / 2>::c>::c;
};
template <typename f, f l> struct k<f, l, e<l % 2>> {
  using c = typename j<typename k<f, l / 2>::c>::c;
};
template <typename f, f l> using m = typename k<f, l>::c;
template <typename> template <a... i> using n = g<unsigned long, i...>;
template <long l> using o = m<unsigned long, l>;
template <a i> void increasing(n<i>) {
  increasing(o<10>{});
}

$ g++ -c -std=c++11 index-sequence.cpp
index-sequence.cpp: In substitution of 'template<long unsigned int i> void
increasing(n<i>) [with long unsigned int i = 1ul]':
index-sequence.cpp:24:21:   required from here
index-sequence.cpp:23:21: internal compiler error: in tsubst, at cp/pt.c:13213
 template <a i> void increasing(n<i>) {
                     ^~~~~~~~~~
0x682fde tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:13213
0x69d1b6 tsubst_template_args
        ../../src/gcc/cp/pt.c:11410
0x69d362 tsubst_template_args
        ../../src/gcc/cp/pt.c:11370
0x681681 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:13434
0x681af9 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:13037
0x69adc2 tsubst_arg_types
        ../../src/gcc/cp/pt.c:12696
0x69b0ea tsubst_function_type
        ../../src/gcc/cp/pt.c:12830
0x6812f6 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:13573
0x693c4c tsubst_decl
        ../../src/gcc/cp/pt.c:11991
0x681837 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:13011
0x6a2d1f instantiate_template_1
        ../../src/gcc/cp/pt.c:17805
0x6a2d1f instantiate_template(tree_node*, tree_node*, int)
        ../../src/gcc/cp/pt.c:17861
0x6ae531 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../src/gcc/cp/pt.c:18241
0x6099f7 add_template_candidate_real
        ../../src/gcc/cp/call.c:3158
0x60a5bc add_template_candidate
        ../../src/gcc/cp/call.c:3240
0x60a5bc add_candidates
        ../../src/gcc/cp/call.c:5475
0x60d071 perform_overload_resolution
        ../../src/gcc/cp/call.c:4136
0x60f5ce build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
        ../../src/gcc/cp/call.c:4221
0x7afcb9 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../src/gcc/cp/semantics.c:2440
0x72b1da cp_parser_postfix_expression
        ../../src/gcc/cp/parser.c:7017
Please submit a full bug report,
with preprocessed source if appropriate.

Reply via email to