aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-08-04 12:06:22 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-08-04 12:06:22 -0400
commitb9dc9ef63fc7bf742f97e1b9618d5818f3383c73 (patch)
treeca5567929a6a7043464182096b33a9b9d4069a6f /gcc
parent6a7b92036be210a11657ce97a936a8548c425341 (diff)
downloadgcc-b9dc9ef63fc7bf742f97e1b9618d5818f3383c73.zip
gcc-b9dc9ef63fc7bf742f97e1b9618d5818f3383c73.tar.gz
gcc-b9dc9ef63fc7bf742f97e1b9618d5818f3383c73.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c6
-rw-r--r--gcc/testsuite/g++.dg/concepts/memfun2.C21
3 files changed, 31 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e7854f7..573ece8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2016-08-04 Jason Merrill <jason@redhat.com>
+ 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 bf729ea..60c87e0 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 0000000..c186a18
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/memfun2.C
@@ -0,0 +1,21 @@
+// PR c++/72415
+// { dg-options "-std=c++1z -fconcepts" }
+
+template<int... Indices>
+struct indices {};
+
+template<typename Dummy>
+struct foo_type {
+ template<int... Indices>
+ static void impl(indices<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<void>::caller();
+}