From 001db6cf52711f785459558508ca6fa97e10bcae Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 4 Apr 2018 15:19:34 -0400 Subject: [PATCH] PR c++/85006 - -fconcepts ICE with A return type * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack. From-SVN: r259100 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 2 +- gcc/testsuite/g++.dg/concepts/auto4.C | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/concepts/auto4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 12d0c10efd5..04670a3acaa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2018-04-04 Jason Merrill + PR c++/85006 - -fconcepts ICE with A return type + * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack. + PR c++/85200 - ICE with constexpr if in generic lambda. * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 80670a4826b..dbbc7666721 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11860,7 +11860,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, /* We can't substitute for this parameter pack. We use a flag as well as the missing_level counter because function parameter packs don't have a level. */ - gcc_assert (processing_template_decl); + gcc_assert (processing_template_decl || is_auto (parm_pack)); unsubstituted_packs = true; } } diff --git a/gcc/testsuite/g++.dg/concepts/auto4.C b/gcc/testsuite/g++.dg/concepts/auto4.C new file mode 100644 index 00000000000..e80341ec038 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/auto4.C @@ -0,0 +1,11 @@ +// PR c++/85006 +// { dg-additional-options "-std=c++17 -fconcepts" } + +template struct A {}; + +template A foo() { return A{}; } + +void bar() +{ + foo(); +} -- 2.30.2