From: Jason Merrill Date: Thu, 4 Aug 2016 16:06:22 +0000 (-0400) Subject: PR c++/72415 - member template with fold-expression constraint X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b9dc9ef63fc7bf742f97e1b9618d5818f3383c73;p=gcc.git PR c++/72415 - member template with fold-expression constraint * pt.c (tsubst_pack_expansion): Pull a single pack expansion out of the TREE_VEC. From-SVN: r239138 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e7854f7505e..573ece8bbad 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2016-08-04 Jason Merrill + PR c++/72415 + * pt.c (tsubst_pack_expansion): Pull a single pack expansion out + of the TREE_VEC. + * cp-tree.h (TYPE_UNNAMED_P): Rename from TYPE_ANONYMOUS_P. (TYPE_WAS_UNNAMED): Rename from TYPE_WAS_ANONYMOUS. * class.c, decl.c, decl2.c, error.c, lambda.c, mangle.c, diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bf729ea3107..60c87e001c0 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11160,6 +11160,12 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, local_specializations = saved_local_specializations; } + /* If the dependent pack arguments were such that we end up with only a + single pack expansion again, there's no need to keep it in a TREE_VEC. */ + if (len == 1 && TREE_CODE (result) == TREE_VEC + && PACK_EXPANSION_P (TREE_VEC_ELT (result, 0))) + return TREE_VEC_ELT (result, 0); + return result; } diff --git a/gcc/testsuite/g++.dg/concepts/memfun2.C b/gcc/testsuite/g++.dg/concepts/memfun2.C new file mode 100644 index 00000000000..c186a183762 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/memfun2.C @@ -0,0 +1,21 @@ +// PR c++/72415 +// { dg-options "-std=c++1z -fconcepts" } + +template +struct indices {}; + +template +struct foo_type { + template + static void impl(indices) + requires (... && (Indices, true)); + + static auto caller() + { return impl(indices<0, 1, 2> {}); } +}; + +int main() +{ + // internal compiler error: in satisfy_predicate_constraint, at cp/constraint.cc:2013 + foo_type::caller(); +}