aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/g++.dg/cpp23/charlit-encoding1.C33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp23/charlit-encoding1.C b/gcc/testsuite/g++.dg/cpp23/charlit-encoding1.C
new file mode 100644
index 0000000..736f022
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/charlit-encoding1.C
@@ -0,0 +1,33 @@
+// PR c++/102615 - P2316R2 - Consistent character literal encoding
+// { dg-do run }
+
+extern "C" void abort ();
+
+int
+main ()
+{
+#if ' ' == 0x20
+ if (' ' != 0x20)
+ abort ();
+#elif ' ' == 0x40
+ if (' ' != 0x40)
+ abort ();
+#else
+ if (' ' == 0x20 || ' ' == 0x40)
+ abort ();
+#endif
+#if 'a' == 0x61
+ if ('a' != 0x61)
+ abort ();
+#elif 'a' == 0x81
+ if ('a' != 0x81)
+ abort ();
+#elif 'a' == -0x7F
+ if ('a' != -0x7F)
+ abort ();
+#else
+ if ('a' == 0x61 || 'a' == 0x81 || 'a' == -0x7F)
+ abort ();
+#endif
+ return 0;
+}