p12.cpp revision b328e29173d15baf3f44ccdc9c310ee741caaaf7
1// RUN: %clang_cc1 -std=gnu++11 -verify %s
2
3template<typename T, T... cs> struct check; // expected-note {{template is declared here}} expected-note {{template is declared here}}
4template<>
5struct check<char, 34, -47, -126, -48, -75, -47, -127, -47, -126, 32, -16, -112, -128, -128>{};
6template<>
7struct check<char16_t, 34, 1090, 1077, 1089, 1090, 32, 55296, 56320>{};
8template<>
9struct check<char32_t, 34, 1090, 1077, 1089, 1090, 32, 65536>{};
10template<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'>'}} expected-error {{implicit instantiation of undefined template 'check<char32_t, 34, 1090, 1077, 1089, 1090, 95, 65536>'}}
12    return 1;
13}
14void *operator""_x(const char*); // #2
15void *a = 123_x; // ok, calls #2
16int b = u8"\"тест ��"_x; // ok, calls #1
17int c = u8R"("тест ��)"_x; // ok, calls #1
18int d = "test"_x; // expected-note {{in instantiation of function template specialization 'operator "" _x<char, 't', 'e', 's', 't'>' requested here}}
19int e = uR"("тест ��)"_x;
20int f = UR"("тест ��)"_x;
21int g = UR"("тест_��)"_x; // expected-note {{in instantiation of function template specialization 'operator "" _x<char32_t, 34, 1090, 1077, 1089, 1090, 95, 65536>' requested here}}
22