| 1 |
// Test overloading for UTF-8 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 fc(char); |
| 14 |
long fc(char8_t); |
| 15 |
static_assert(is_same<decltype(fc('x')), int>::value, "Error"); |
| 16 |
static_assert(is_same<decltype(fc(u8'x')), long>::value, "Error"); |
| 17 |
|
| 18 |
int fs(const char*); |
| 19 |
long fs(const char8_t*); |
| 20 |
static_assert(is_same<decltype(fs("x")), int>::value, "Error"); |
| 21 |
static_assert(is_same<decltype(fs(u8"x")), long>::value, "Error"); |
| 22 |
|
| 23 |
int fr(const char(&)[2]); |
| 24 |
long fr(const char8_t(&)[2]); |
| 25 |
static_assert(is_same<decltype(fr("x")), int>::value, "Error"); |
| 26 |
static_assert(is_same<decltype(fr(u8"x")), long>::value, "Error"); |