]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: parameter pack inside static_assert [PR99893]
authorPatrick Palka <ppalka@redhat.com>
Thu, 27 May 2021 18:25:33 +0000 (14:25 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 27 May 2021 18:25:33 +0000 (14:25 -0400)
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.

gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp0x/static_assert17.C [new file with mode: 0644]

index 372d89fa9edd05c79c67bba9914f1c5ab8fe6a32..fec5afaa2be13f30e34256833dd88b53f6f5b72f 100644 (file)
@@ -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 (file)
index 0000000..28cbebe
--- /dev/null
@@ -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, ""); }...);
+}