https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84015
Bug ID: 84015 Summary: [7/8 Regression] ICE with class template argument deduction Product: gcc Version: 8.0 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 CC: jason at gcc dot gnu.org Target Milestone: --- The following valid testcase (compiled with "-std=c++1z") triggers an ICE since GCC 7.1.0: ========================================= template <int I> struct A { }; template <int I> struct B { template<template<auto>class T> B(T<I>); }; A<42> a; B b (a); ========================================= bug.cc:7:21: internal compiler error: in tsubst, at cp/pt.c:13765 template<template<auto>class T> ^~~~ 0x640c75 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:13765 0x9721fb tsubst_decl ../../gcc/gcc/cp/pt.c:12737 0x96c2af tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:13562 0x96d7a6 tsubst_template_parm ../../gcc/gcc/cp/pt.c:11933 0x96d7a6 tsubst_template_parms_level ../../gcc/gcc/cp/pt.c:11870 0x95bd13 rewrite_template_parm ../../gcc/gcc/cp/pt.c:25477 0x95bd13 build_deduction_guide ../../gcc/gcc/cp/pt.c:25609 0x95cacc do_class_deduction ../../gcc/gcc/cp/pt.c:25758 0x95cacc do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*, int) ../../gcc/gcc/cp/pt.c:25893 0x896213 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc/gcc/cp/decl.c:6801 0x931433 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:19657 0x938f48 cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:13001 0x939d58 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:12826 0x93dcb2 cp_parser_declaration ../../gcc/gcc/cp/parser.c:12724 0x93e0c1 cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:12600 0x93e3b4 cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:4559 0x93e3b4 c_parse_file() ../../gcc/gcc/cp/parser.c:38820 0xa3c366 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1132 Please submit a full bug report, [etc.] The testcase was derived from gcc/testsuite/g++.dg/cpp1z/class-deduction3.C The code is accepted by clang 5.0.0 onward. Jason, you implemented template argument deduction for class templates. Would you mind having a look?