1// RUN: %clang_cc1 %s -fsyntax-only -verify
2// RUN: %clang_cc1 %s -fsyntax-only -fshort-wchar -verify -DSHORT_WCHAR
3
4typedef __WCHAR_TYPE__ wchar_t;
5
6#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
7 || defined(_M_X64) || 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) || defined(__AuroraUX__)
12  #define WCHAR_T_TYPE long
13#else /* Solaris or AuroraUX. */
14  #define WCHAR_T_TYPE int
15#endif
16
17int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
18
19void foo() {
20  WCHAR_T_TYPE t1[] = L"x";
21  wchar_t tab[] = L"x";
22  WCHAR_T_TYPE t2[] = "x";     // expected-error {{initializing wide char array with non-wide string literal}}
23  char t3[] = L"x";   // expected-error {{initializing char array with wide string literal}}
24}
25