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

            Bug ID: 84355
           Summary: [7/8 Regression] ICE with failing template argument
                    deduction
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet (compiled with "-std=c++1z")
trigges an ICE since GCC 7.1.0:

====================================
template<typename T> struct A
{
  template<int> struct B
  {
    B(T);
  };

  A() { B b(0); }
};

A<int> a;
====================================

bug.cc: In substitution of 'template<int <anonymous> > B(T)->
A<T>::B<<enumerator> > [with int <anonymous> = <missing>]':
bug.cc:8:11:   required from 'A<T>::A() [with T = int]'
bug.cc:11:8:   required from here
bug.cc:8:11: internal compiler error: in unify, at cp/pt.c:20924
   A() { B b(0); }
           ^
0x63ad48 unify
        ../../gcc/gcc/cp/pt.c:20924
0x97e293 unify_one_argument
        ../../gcc/gcc/cp/pt.c:19528
0x981ce4 type_unification_real
        ../../gcc/gcc/cp/pt.c:19648
0x984345 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:19033
0x825def add_template_candidate_real
        ../../gcc/gcc/cp/call.c:3176
0x826800 add_template_candidate
        ../../gcc/gcc/cp/call.c:3255
0x826800 add_candidates
        ../../gcc/gcc/cp/call.c:5514
0x826c21 add_candidates
        ../../gcc/gcc/cp/call.c:4190
0x826c21 perform_overload_resolution
        ../../gcc/gcc/cp/call.c:4198
0x828ca2 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc/gcc/cp/call.c:4271
0x95fcb0 do_class_deduction
        ../../gcc/gcc/cp/pt.c:25925
0x95fcb0 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ../../gcc/gcc/cp/pt.c:25991
0x8989c3 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6820
0x96a4db tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16203
0x965eb1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16336
0x9666c1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16059
0x965eb1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16336
0x965148 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16044
0x965148 instantiate_decl(tree_node*, bool, bool)
        ../../gcc/gcc/cp/pt.c:23398
0x98f79b instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:23514
Please submit a full bug report, [etc.]

Reply via email to