1 // RUN: %clang_cc1 %s -fsyntax-only -verify
2 // RUN: %clang_cc1 %s -fsyntax-only -fwchar-type=short -fno-signed-wchar -verify -DSHORT_WCHAR
4 typedef __WCHAR_TYPE__
wchar_t;
6 #if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
7 || defined(_M_X64) || defined(__ORBIS__) || defined(__PROSPERO__) \
8 || defined(SHORT_WCHAR) || (defined(_AIX) && !defined(__64BIT__))
9 #define WCHAR_T_TYPE unsigned short
10 #elif defined(__aarch64__)
11 // See AArch64TargetInfo constructor -- unsigned on non-darwin non-OpenBSD non-NetBSD.
12 #if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__)
13 #define WCHAR_T_TYPE int
15 #define WCHAR_T_TYPE unsigned int
17 #elif defined(__arm) || defined(__MVS__) || (defined(_AIX) && defined(__64BIT__))
18 #define WCHAR_T_TYPE unsigned int
21 #define WCHAR_T_TYPE int
23 #define WCHAR_T_TYPE long
25 #else /* Solaris, Linux, non-arm64 macOS, ... */
26 #define WCHAR_T_TYPE int
29 int check_wchar_size
[sizeof(*L
"") == sizeof(wchar_t) ? 1 : -1];
32 WCHAR_T_TYPE t1
[] = L
"x";
34 WCHAR_T_TYPE t2
[] = "x"; // expected-error {{initializing wide char array with non-wide string literal}}
35 char t3
[] = L
"x"; // expected-error {{initializing char array with wide string literal}}