aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c23-utf8char-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/c23-utf8char-3.c')
-rw-r--r--gcc/testsuite/gcc.dg/c23-utf8char-3.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c23-utf8char-3.c b/gcc/testsuite/gcc.dg/c23-utf8char-3.c
new file mode 100644
index 0000000..e152edb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c23-utf8char-3.c
@@ -0,0 +1,8 @@
+/* Test C23 UTF-8 characters. Test errors for invalid code. */
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -pedantic-errors" } */
+
+unsigned char a = u8''; /* { dg-error "empty character constant" } */
+unsigned char b = u8'ab'; /* { dg-error "character constant too long for its type" } */
+unsigned char c = u8'\u00ff'; /* { dg-error "character constant too long for its type" } */
+unsigned char d = u8'\x100'; /* { dg-error "hex escape sequence out of range" } */