c++: Add testcase for already fixed PR [PR103443]
authorPatrick Palka <ppalka@redhat.com>
Fri, 4 Mar 2022 15:17:30 +0000 (10:17 -0500)
committerPatrick Palka <ppalka@redhat.com>
Fri, 4 Mar 2022 15:17:30 +0000 (10:17 -0500)
Fixed by r12-7264.

PR c++/103443

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/consteval29.C: New test.

gcc/testsuite/g++.dg/cpp2a/consteval29.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval29.C b/gcc/testsuite/g++.dg/cpp2a/consteval29.C
new file mode 100644 (file)
index 0000000..6159022
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/103443
+// { dg-do compile { target c++20 } }
+
+template<int...>
+struct A { };
+
+template<int... Is>
+consteval unsigned index_sequence2mask(A<Is...>) {
+  if constexpr (sizeof...(Is) == 0u)
+    return 0u;
+  else
+    return ((1u << Is) | ...);
+}
+
+template<unsigned Mask = index_sequence2mask(A<1,2,3>{})>
+void use_mask();
+
+int main() {
+  use_mask();
+}