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

            Bug ID: 84937
           Summary: [7/8 Regression] ICE with class template argument
                    deduction and auto
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Keywords: ice-on-valid-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 valid code snippet (compiled with "-std=c++17")
triggers an ICE since GCC 7.1.0:

==================================
template<int, int> struct A {};

template<int I> struct B
{
  template<auto J> B(A<I,J>);
};

B b(A<0,0>{});
==================================

bug.cc: In substitution of 'template<int I, auto J> B(A<I, J>)-> B<I> [with int
I = <missing>; auto J = <missing>]':
bug.cc:8:13:   required from here
bug.cc:8:13: internal compiler error: in tsubst, at cp/pt.c:14007
 B b(A<0,0>{});
             ^
0x643561 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:14007
0x9699e8 unify
        ../../gcc/gcc/cp/pt.c:21239
0x968f44 unify
        ../../gcc/gcc/cp/pt.c:21434
0x989312 try_class_unification
        ../../gcc/gcc/cp/pt.c:20439
0x968fc5 unify
        ../../gcc/gcc/cp/pt.c:21471
0x985d13 unify_one_argument
        ../../gcc/gcc/cp/pt.c:19681
0x989763 type_unification_real
        ../../gcc/gcc/cp/pt.c:19801
0x98be55 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:19186
0x82af2f add_template_candidate_real
        ../../gcc/gcc/cp/call.c:3179
0x82b940 add_template_candidate
        ../../gcc/gcc/cp/call.c:3258
0x82b940 add_candidates
        ../../gcc/gcc/cp/call.c:5523
0x82bd61 add_candidates
        ../../gcc/gcc/cp/call.c:4195
0x82bd61 perform_overload_resolution
        ../../gcc/gcc/cp/call.c:4203
0x82dde2 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc/gcc/cp/call.c:4276
0x967298 do_class_deduction
        ../../gcc/gcc/cp/pt.c:26163
0x967298 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ../../gcc/gcc/cp/pt.c:26218
0x89e733 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6909
0x93b893 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:19723
0x942cc8 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:13057
0x943ad8 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:12882
Please submit a full bug report, [etc.]

Reply via email to