| 1 |
// RUN: %clang_cc1 -std=gnu++11 -verify %s |
| 2 |
|
| 3 |
template<typename T, T... cs> struct check; // expected-note {{template is declared here}} expected-note {{template is declared here}} |
| 4 |
template<> |
| 5 |
struct check<char, 34, -47, -126, -48, -75, -47, -127, -47, -126, 32, -16, -112, -128, -128>{}; |
| 6 |
template<> |
| 7 |
struct check<char16_t, 34, 1090, 1077, 1089, 1090, 32, 55296, 56320>{}; |
| 8 |
template<> |
| 9 |
struct check<char32_t, 34, 1090, 1077, 1089, 1090, 32, 65536>{}; |
| 10 |
template<typename T, T... str> int operator""_x() { // #1 expected-warning {{string literal operator templates are a GNU extension}} |
| 11 |
check<T, str...> chars; // expected-error {{implicit instantiation of undefined template 'check<char, 't', 'e', 's', 't'>'}} \ |
| 12 |
// expected-error {{implicit instantiation of undefined template 'check<char32_t, U'"', U'\u0442', U'\u0435', U'\u0441', U'\u0442', U'_', U'\U00010000'>'}} |
| 13 |
return 1; |
| 14 |
} |
| 15 |
void *operator""_x(const char*); // #2 |
| 16 |
void *a = 123_x; // ok, calls #2 |
| 17 |
int b = u8"\"ัะตัั ๐"_x; // ok, calls #1 |
| 18 |
int c = u8R"("ัะตัั ๐)"_x; // ok, calls #1 |
| 19 |
int d = "test"_x; // expected-note {{in instantiation of function template specialization 'operator""_x<char, 't', 'e', 's', 't'>' requested here}} |
| 20 |
int e = uR"("ัะตัั ๐)"_x; |
| 21 |
int f = UR"("ัะตัั ๐)"_x; |
| 22 |
int g = UR"("ัะตัั_๐)"_x; // expected-note {{in instantiation of function template specialization 'operator""_x<char32_t, U'"', U'\u0442', U'\u0435', U'\u0441', U'\u0442', U'_', U'\U00010000'>' requested here}} |