Debian Codegraph @

gcc/testsuite/g++.dg/ext/char8_t-char-literal-1.C

raw
1 // Test that UTF-8 character literals have type char if -fchar8_t is not enabled.
2 // { dg-do compile }
3 // { dg-options "-std=c++17 -fsigned-char -fno-char8_t" }
4
5 template<typename T1, typename T2>
6 struct is_same
7 { static const bool value = false; };
8 template<typename T>
9 struct is_same<T, T>
10 { static const bool value = true; };
11
12 static_assert(is_same<decltype(u8'x'), char>::value, "Error");
13
14 #if u8'\0' - 1 > 0
15 #error "UTF-8 character literals not signed in preprocessor"
16 #endif