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?
GCC 7.3 is being released, adjusting target milestone.
Started with commit b1363399fad470a536bd8731be39c3fbfe4e6fad Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Wed Nov 9 20:02:50 2016 +0000 Implement P0127R2, Declaring non-type parameters with auto. gcc/cp/ * cp-tree.h (enum auto_deduction_context): Add adc_unify. * decl.c (grokdeclarator): Allow 'auto' in C++17 template non-type parameter types. * pt.c (do_auto_deduction): Add outer_targs parameter. (convert_template_argument): Call do_auto_deduction. If adc_unify, don't give up on dependent init. (unify): Likewise. In C++17, walk into the type of a TEMPLATE_PARM_INDEX. (for_each_template_parm): Add any_fn parameter. (struct pair_fn_data): Likewise. (for_each_template_parm_r): Call it for any tree. In C++17, walk into the type of a TEMPLATE_PARM_INDEX. (zero_r, array_deduction_r, try_array_deduction): New. (type_unification_real): Call try_array_deduction. (get_partial_spec_bindings): Likewise. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_template_auto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242017 138bc75d-0d04-0410-961f-82ee72b054a4
Author: jason Date: Mon Feb 26 05:05:15 2018 New Revision: 257979 URL: https://gcc.gnu.org/viewcvs?rev=257979&root=gcc&view=rev Log: PR c++/84015 - ICE with class deduction and auto template parm. * pt.c (rewrite_template_parm): Use tf_partial in first tsubst. Added: trunk/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c
Author: jason Date: Mon Feb 26 06:09:01 2018 New Revision: 257980 URL: https://gcc.gnu.org/viewcvs?rev=257980&root=gcc&view=rev Log: PR c++/84015 - ICE with class deduction and auto template parm. * pt.c (rewrite_template_parm): Use tf_partial in first tsubst. Added: branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C Modified: branches/gcc-7-branch/gcc/cp/ChangeLog branches/gcc-7-branch/gcc/cp/pt.c
Fixed.