[committed] c++: Add testcase for already fixed PR [PR103443]

Patrick Palka ppalka@redhat.com
Fri Mar 4 15:18:26 GMT 2022


Fixed by r12-7264.

	PR c++/103443

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/consteval29.C: New test.
---
 gcc/testsuite/g++.dg/cpp2a/consteval29.C | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp2a/consteval29.C

diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval29.C b/gcc/testsuite/g++.dg/cpp2a/consteval29.C
new file mode 100644
index 00000000000..61590225bd6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval29.C
@@ -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();
+}
-- 
2.35.1.354.g715d08a9e5



More information about the Gcc-patches mailing list