blob: 8708aa0f65c30daa45d3be6e488c09dbe130cff4 [file] [log] [blame]
Daniel Dunbar80737ad2009-12-15 22:01:24 +00001// RUN: %clang %s -fsyntax-only -Xclang -verify
2// RUN: %clang %s -fsyntax-only -fshort-wchar -Xclang -verify -DSHORT_WCHAR
Benjamin Kramer947e00d2009-11-17 14:02:16 +00003
4typedef __WCHAR_TYPE__ wchar_t;
5
John Thompsona6fda122009-11-05 20:14:16 +00006#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
7 || defined(_M_X64) || defined(SHORT_WCHAR)
8 #define WCHAR_T_TYPE unsigned short
Hans Wennborg4c6d6dc2012-09-25 10:11:17 +00009#elif defined(__arm)
10 #define WCHAR_T_TYPE unsigned int
Edward O'Callaghan11ac3f52009-11-22 16:21:47 +000011#elif defined(__sun) || defined(__AuroraUX__)
12 #define WCHAR_T_TYPE long
13#else /* Solaris or AuroraUX. */
John Thompsona6fda122009-11-05 20:14:16 +000014 #define WCHAR_T_TYPE int
15#endif
16
Chris Lattner19753cf2009-02-26 23:36:02 +000017int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
John Thompsona6fda122009-11-05 20:14:16 +000018
Chris Lattner19753cf2009-02-26 23:36:02 +000019void foo() {
John Thompsona6fda122009-11-05 20:14:16 +000020 WCHAR_T_TYPE t1[] = L"x";
Chris Lattner19753cf2009-02-26 23:36:02 +000021 wchar_t tab[] = L"x";
Eli Friedmancfdc81a2009-12-19 08:11:05 +000022 WCHAR_T_TYPE t2[] = "x"; // expected-error {{initializer}}
23 char t3[] = L"x"; // expected-error {{initializer}}
Chris Lattner19753cf2009-02-26 23:36:02 +000024}