diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-05-27 14:25:33 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-05-27 14:25:33 -0400 |
commit | fc3fdf0f2196e805a3a43ccb73595c33673670f3 (patch) | |
tree | 4b5f049eec6ca217a40b94508be4f347a5f7ec5a /gcc | |
parent | db79713150f4f8b6ff3de81d00d92578679e0e65 (diff) | |
download | gcc-fc3fdf0f2196e805a3a43ccb73595c33673670f3.tar.gz |
c++: parameter pack inside static_assert [PR99893]
Here, we're not finding the parameter pack inside the static_assert because
STATIC_ASSERT trees are tcc_exceptional, and we weren't explicitly walking
them in cp_walk_subtrees.
PR c++/99893
gcc/cp/ChangeLog:
* tree.c (cp_walk_subtrees) <case STATIC_ASSERT>: New case.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/static_assert17.C: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/tree.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/static_assert17.C | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 372d89fa9ed..fec5afaa2be 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -5446,6 +5446,11 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func, } break; + case STATIC_ASSERT: + WALK_SUBTREE (STATIC_ASSERT_CONDITION (*tp)); + WALK_SUBTREE (STATIC_ASSERT_MESSAGE (*tp)); + break; + default: return NULL_TREE; } diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert17.C b/gcc/testsuite/g++.dg/cpp0x/static_assert17.C new file mode 100644 index 00000000000..28cbebe93af --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert17.C @@ -0,0 +1,9 @@ +// PR c++/99893 +// { dg-do compile { target c++11 } } + +void f(...); + +template<class... Ts> +void g() { + f([] { static_assert(Ts::value, ""); }...); +} |