Shih-wei Liao | f8fd82b | 2010-02-10 11:10:31 -0800 | [diff] [blame^] | 1 | // RUN: %clang %s -fsyntax-only -Xclang -verify |
| 2 | // RUN: %clang %s -fsyntax-only -fshort-wchar -Xclang -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(SHORT_WCHAR) |
| 8 | #define WCHAR_T_TYPE unsigned short |
| 9 | #elif defined(__sun) || defined(__AuroraUX__) |
| 10 | #define WCHAR_T_TYPE long |
| 11 | #else /* Solaris or AuroraUX. */ |
| 12 | #define WCHAR_T_TYPE int |
| 13 | #endif |
| 14 | |
| 15 | int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1]; |
| 16 | |
| 17 | void foo() { |
| 18 | WCHAR_T_TYPE t1[] = L"x"; |
| 19 | wchar_t tab[] = L"x"; |
| 20 | WCHAR_T_TYPE t2[] = "x"; // expected-error {{initializer}} |
| 21 | char t3[] = L"x"; // expected-error {{initializer}} |
| 22 | } |