1 // RUN: %clang_cc1 %s -fsyntax-only -verify 2 // RUN: %clang_cc1 %s -fsyntax-only -fwchar-type=short -fno-signed-wchar -verify -DSHORT_WCHAR 3 4 typedef __WCHAR_TYPE__ wchar_t; 5 6 #if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \ 7 || defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR) 8 #define WCHAR_T_TYPE unsigned short 9 #elif defined(__arm) || defined(__aarch64__) 10 #define WCHAR_T_TYPE unsigned int 11 #elif defined(__sun) 12 #if defined(__LP64__) 13 #define WCHAR_T_TYPE int 14 #else 15 #define WCHAR_T_TYPE long 16 #endif 17 #else /* Solaris. */ 18 #define WCHAR_T_TYPE int 19 #endif 20 21 int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1]; 22 foo()23void foo() { 24 WCHAR_T_TYPE t1[] = L"x"; 25 wchar_t tab[] = L"x"; 26 WCHAR_T_TYPE t2[] = "x"; // expected-error {{initializing wide char array with non-wide string literal}} 27 char t3[] = L"x"; // expected-error {{initializing char array with wide string literal}} 28 } 29