Debian Codegraph @

gcc/testsuite/g++.dg/ext/char8_t-udl-2.C

raw
1 // Test overloading for UTF-8 user defined literals when -fchar8_t is in effect.
2 // { dg-do compile }
3 // { dg-options "-std=c++17 -fchar8_t" }
4
5 template<typename T1, typename T2>
6 struct is_same
7 { static const bool value = false; };
8
9 template<typename T>
10 struct is_same<T, T>
11 { static const bool value = true; };
12
13 int operator "" _udcl(char);
14 long operator "" _udcl(char8_t);
15 static_assert(is_same<decltype('x'_udcl), int>::value, "Error");
16 static_assert(is_same<decltype(u8'x'_udcl), long>::value, "Error");
17
18 int operator "" _udsl(const char*, __SIZE_TYPE__);
19 long operator "" _udsl(const char8_t*, __SIZE_TYPE__);
20 static_assert(is_same<decltype("x"_udsl), int>::value, "Error");
21 static_assert(is_same<decltype(u8"x"_udsl), long>::value, "Error");