public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] c++: Find parameter pack in typedef in lambda [92909].
@ 2020-03-19 12:43 Nathan Sidwell
0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-03-19 12:43 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:b3b0c671cc341fd04afc045a8d42d7a845d7f73c
commit b3b0c671cc341fd04afc045a8d42d7a845d7f73c
Author: Jason Merrill <jason@redhat.com>
Date: Sat Mar 14 17:10:39 2020 -0400
c++: Find parameter pack in typedef in lambda [92909].
find_parameter_packs_r doesn't look through typedefs, which is normally
correct, but that means we need to handle their declarations specially.
gcc/cp/ChangeLog
2020-03-14 Jason Merrill <jason@redhat.com>
PR c++/92909
* pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
DECL_ORIGINAL_TYPE of a typedef.
Diff:
---
gcc/cp/ChangeLog | 6 ++++++
gcc/cp/pt.c | 16 ++++++++++++----
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic10.C | 12 ++++++++++++
3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b4fa15047b5..bb7f590ea0b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/92909
+ * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
+ DECL_ORIGINAL_TYPE of a typedef.
+
2020-03-14 Jason Merrill <jason@redhat.com>
PR c++/93248
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 0f3c2ad8fec..bd2f9be82ea 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3916,10 +3916,18 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
return NULL_TREE;
case DECL_EXPR:
- /* Ignore the declaration of a capture proxy for a parameter pack. */
- if (is_capture_proxy (DECL_EXPR_DECL (t)))
- *walk_subtrees = 0;
- return NULL_TREE;
+ {
+ tree decl = DECL_EXPR_DECL (t);
+ /* Ignore the declaration of a capture proxy for a parameter pack. */
+ if (is_capture_proxy (decl))
+ *walk_subtrees = 0;
+ if (is_typedef_decl (decl))
+ /* Since we stop at typedefs above, we need to look through them at
+ the point of the DECL_EXPR. */
+ cp_walk_tree (&DECL_ORIGINAL_TYPE (decl),
+ &find_parameter_packs_r, ppd, ppd->visited);
+ return NULL_TREE;
+ }
case TEMPLATE_DECL:
if (!DECL_TEMPLATE_TEMPLATE_PARM_P (t))
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic10.C
new file mode 100644
index 00000000000..052283e6caa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic10.C
@@ -0,0 +1,12 @@
+// PR c++/92909
+// { dg-do compile { target c++11 } }
+
+template <class ... Ts>
+void foo()
+{
+ []
+ {
+ using T = Ts;
+ }(); // { dg-error "not expanded" }
+}
+template void foo<>();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-19 12:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 12:43 [gcc/devel/c++-modules] c++: Find parameter pack in typedef in lambda [92909] Nathan Sidwell
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).