Debian Codegraph @

gcc/testsuite/gcc.dg/c23-constexpr-6.c

raw
1 /* Test C23 constexpr. Invalid code, compilation tests, signed char. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c23 -pedantic-errors -fsigned-char" } */
4
5 constexpr unsigned char v3[] = "\x00\xff"; /* { dg-error "'constexpr' initializer not representable in type of object" } */
6 constexpr char v4[] = u8"\x00\xff"; /* { dg-error "'constexpr' initializer not representable in type of object" } */
7 constexpr signed char v5[] = u8"\x00\xff"; /* { dg-error "'constexpr' initializer not representable in type of object" } */
8
9 void
10 f0 ()
11 {
12 (constexpr unsigned char []) { "\x00\xff" }; /* { dg-error "'constexpr' initializer not representable in type of object" } */
13 (constexpr char []) { u8"\x00\xff" }; /* { dg-error "'constexpr' initializer not representable in type of object" } */
14 (constexpr signed char []) { u8"\x00\xff" }; /* { dg-error "'constexpr' initializer not representable in type of object" } */
15 }