public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7] c++: unexpanded pack in enum in lambda [PR100109]
@ 2021-04-20 12:35 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2021-04-20 12:35 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7f5deba1c21888aacedae93e9f324827073a1d1e
commit r12-7-g7f5deba1c21888aacedae93e9f324827073a1d1e
Author: Jason Merrill <jason@redhat.com>
Date: Tue Apr 20 00:50:49 2021 -0400
c++: unexpanded pack in enum in lambda [PR100109]
Another construct we need to look inside.
gcc/cp/ChangeLog:
PR c++/100109
* pt.c (find_parameter_packs_r): Look into enum initializers.
gcc/testsuite/ChangeLog:
PR c++/100109
* g++.dg/cpp0x/lambda/lambda-variadic14.C: New test.
Diff:
---
gcc/cp/pt.c | 8 +++++++-
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C | 8 ++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 19fdafa4c43..7bcbe6dc3ce 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4066,12 +4066,18 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
return NULL_TREE;
case TAG_DEFN:
- /* Local class, need to look through the whole definition. */
t = TREE_TYPE (t);
if (CLASS_TYPE_P (t))
+ /* Local class, need to look through the whole definition. */
for (tree bb : BINFO_BASE_BINFOS (TYPE_BINFO (t)))
cp_walk_tree (&BINFO_TYPE (bb), &find_parameter_packs_r,
ppd, ppd->visited);
+ else
+ /* Enum, look at the values. */
+ for (tree l = TYPE_VALUES (t); l; l = TREE_CHAIN (l))
+ cp_walk_tree (&DECL_INITIAL (TREE_VALUE (l)),
+ &find_parameter_packs_r,
+ ppd, ppd->visited);
return NULL_TREE;
case FUNCTION_TYPE:
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C
new file mode 100644
index 00000000000..185aa0332e7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C
@@ -0,0 +1,8 @@
+// PR c++/100109
+// { dg-do compile { target c++11 } }
+
+template <int... E>
+void f() {
+ [] { enum e { e = E }; }; // { dg-error "not expanded" }
+}
+template void f<>();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-20 12:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 12:35 [gcc r12-7] c++: unexpanded pack in enum in lambda [PR100109] Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).