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
|
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";
|
2009-11-06 04:14:16 +08:00
|
|
|
WCHAR_T_TYPE t2[] = "x"; // expected-error {{initialization}}
|
2009-02-27 07:36:02 +08:00
|
|
|
char t3[] = L"x"; // expected-error {{initialization}}
|
|
|
|
}
|