1*67e74705SXin Li // RUN: %clang_cc1 -std=c11 -fsyntax-only -triple x86_64-pc-linux -verify %s 2*67e74705SXin Li 3*67e74705SXin Li // Note: these match the types specified by the target above. 4*67e74705SXin Li typedef int wchar_t; 5*67e74705SXin Li typedef unsigned short char16_t; 6*67e74705SXin Li typedef unsigned int char32_t; 7*67e74705SXin Li f()8*67e74705SXin Livoid f() { 9*67e74705SXin Li char a1[] = "a"; // No error. 10*67e74705SXin Li char a2[] = u8"a"; // No error. 11*67e74705SXin Li char a3[] = u"a"; // expected-error{{initializing char array with wide string literal}} 12*67e74705SXin Li char a4[] = U"a"; // expected-error{{initializing char array with wide string literal}} 13*67e74705SXin Li char a5[] = L"a"; // expected-error{{initializing char array with wide string literal}} 14*67e74705SXin Li 15*67e74705SXin Li wchar_t b1[] = "a"; // expected-error{{initializing wide char array with non-wide string literal}} 16*67e74705SXin Li wchar_t b2[] = u8"a"; // expected-error{{initializing wide char array with non-wide string literal}} 17*67e74705SXin Li wchar_t b3[] = u"a"; // expected-error{{initializing wide char array with incompatible wide string literal}} 18*67e74705SXin Li wchar_t b4[] = U"a"; // expected-error{{initializing wide char array with incompatible wide string literal}} 19*67e74705SXin Li wchar_t b5[] = L"a"; // No error. 20*67e74705SXin Li 21*67e74705SXin Li char16_t c1[] = "a"; // expected-error{{initializing wide char array with non-wide string literal}} 22*67e74705SXin Li char16_t c2[] = u8"a"; // expected-error{{initializing wide char array with non-wide string literal}} 23*67e74705SXin Li char16_t c3[] = u"a"; // No error. 24*67e74705SXin Li char16_t c4[] = U"a"; // expected-error{{initializing wide char array with incompatible wide string literal}} 25*67e74705SXin Li char16_t c5[] = L"a"; // expected-error{{initializing wide char array with incompatible wide string literal}} 26*67e74705SXin Li 27*67e74705SXin Li char32_t d1[] = "a"; // expected-error{{initializing wide char array with non-wide string literal}} 28*67e74705SXin Li char32_t d2[] = u8"a"; // expected-error{{initializing wide char array with non-wide string literal}} 29*67e74705SXin Li char32_t d3[] = u"a"; // expected-error{{initializing wide char array with incompatible wide string literal}} 30*67e74705SXin Li char32_t d4[] = U"a"; // No error. 31*67e74705SXin Li char32_t d5[] = L"a"; // expected-error{{initializing wide char array with incompatible wide string literal}} 32*67e74705SXin Li 33*67e74705SXin Li int e1[] = "a"; // expected-error{{initializing wide char array with non-wide string literal}} 34*67e74705SXin Li int e2[] = u8"a"; // expected-error{{initializing wide char array with non-wide string literal}} 35*67e74705SXin Li int e3[] = u"a"; // expected-error{{initializing wide char array with incompatible wide string literal}} 36*67e74705SXin Li int e4[] = U"a"; // expected-error{{initializing wide char array with incompatible wide string literal}} 37*67e74705SXin Li int e5[] = L"a"; // No error. 38*67e74705SXin Li 39*67e74705SXin Li long f1[] = "a"; // expected-error{{array initializer must be an initializer list}} 40*67e74705SXin Li long f2[] = u8"a"; // expected-error{{array initializer must be an initializer list}}} 41*67e74705SXin Li long f3[] = u"a"; // expected-error{{array initializer must be an initializer list}} 42*67e74705SXin Li long f4[] = U"a"; // expected-error{{array initializer must be an initializer list}} 43*67e74705SXin Li long f5[] = L"a"; // expected-error{{array initializer must be an initializer list}} 44*67e74705SXin Li } 45*67e74705SXin Li g()46*67e74705SXin Livoid g() { 47*67e74705SXin Li char a[] = 1; // expected-error{{array initializer must be an initializer list or string literal}} 48*67e74705SXin Li wchar_t b[] = 1; // expected-error{{array initializer must be an initializer list or wide string literal}} 49*67e74705SXin Li char16_t c[] = 1; // expected-error{{array initializer must be an initializer list or wide string literal}} 50*67e74705SXin Li char32_t d[] = 1; // expected-error{{array initializer must be an initializer list or wide string literal}} 51*67e74705SXin Li } 52