[pushed] c++: variadic lambda noexcept-specifier [PR99583]

Message ID 20210401200650.403217-1-jason@redhat.com
State New
Headers show
Series
  • [pushed] c++: variadic lambda noexcept-specifier [PR99583]
Related show

Commit Message

Andrew MacLeod via Gcc-patches April 1, 2021, 8:06 p.m.
The tree-walk looking for parameter packs didn't find this one because we
weren't stepping into TYPE_RAISES_EXCEPTIONS.

Tested x86_64-pc-linux-gnu, applying to trunk.

gcc/cp/ChangeLog:

	PR c++/99583
	PR c++/99584
	* tree.c (cp_walk_subtrees) [FUNCTION_TYPE]: Walk into
	TYPE_RAISES_EXCEPTIONS.

gcc/testsuite/ChangeLog:

	PR c++/99583
	* g++.dg/cpp0x/lambda/lambda-variadic12.C: New test.
---
 gcc/cp/tree.c                                         | 5 +++++
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C | 9 +++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C


base-commit: af78514a18ca5c9aaa10813bb4dc639d7ccdf0cc
-- 
2.27.0

Patch

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index dca947bf52a..13cc61c3123 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -5415,6 +5415,11 @@  cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
 	}
       break;
 
+    case FUNCTION_TYPE:
+    case METHOD_TYPE:
+      WALK_SUBTREE (TYPE_RAISES_EXCEPTIONS (*tp));
+      break;
+
     default:
       return NULL_TREE;
     }
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C
new file mode 100644
index 00000000000..674615748e6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C
@@ -0,0 +1,9 @@ 
+// PR c++/99583
+// { dg-do compile { target c++11 } }
+
+void f(...);
+
+template <bool... B>
+void g() {
+ f([]() noexcept(B) {} ...);
+}