2009-12-16 06:01:24 +08:00
|
|
|
// RUN: %clang %s -fsyntax-only -Xclang -verify
|
|
|
|
// RUN: %clang %s -fsyntax-only -fshort-wchar -Xclang -verify -DSHORT_WCHAR
|
2009-11-17 22:02:16 +08:00
|
|
|
|
|
|
|
typedef __WCHAR_TYPE__ wchar_t;
|
|
|
|
|
2009-11-06 04:14:16 +08:00
|
|
|
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
|
|
|
|
|| defined(_M_X64) || defined(SHORT_WCHAR)
|
|
|
|
#define WCHAR_T_TYPE unsigned short
|
2013-02-07 23:11:44 +08:00
|
|
|
#elif defined(__arm) || defined(__aarch64__)
|
2012-09-25 18:11:17 +08:00
|
|
|
#define WCHAR_T_TYPE unsigned int
|
2009-11-23 00:21:47 +08:00
|
|
|
#elif defined(__sun) || defined(__AuroraUX__)
|
|
|
|
#define WCHAR_T_TYPE long
|
|
|
|
#else /* Solaris or AuroraUX. */
|
2009-11-06 04:14:16 +08:00
|
|
|
#define WCHAR_T_TYPE int
|
|
|
|
#endif
|
|
|
|
|
2009-02-27 07:36:02 +08:00
|
|
|
int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
|
2009-11-06 04:14:16 +08:00
|
|
|
|
2009-02-27 07:36:02 +08:00
|
|
|
void foo() {
|
2009-11-06 04:14:16 +08:00
|
|
|
WCHAR_T_TYPE t1[] = L"x";
|
2009-02-27 07:36:02 +08:00
|
|
|
wchar_t tab[] = L"x";
|
2013-05-15 19:03:04 +08:00
|
|
|
WCHAR_T_TYPE t2[] = "x"; // expected-error {{initializing wide char array with non-wide string literal}}
|
|
|
|
char t3[] = L"x"; // expected-error {{initializing char array with wide string literal}}
|
2009-02-27 07:36:02 +08:00
|
|
|
}
|