blob: f8b3a304c74819da21e0fb9422158613c7d1afac [file] [log] [blame]
Daniel Dunbar8b576972009-11-08 01:45:36 +00001// RUN: clang-cc %s -fsyntax-only -verify
John Thompsoned4e2952009-11-05 20:14:16 +00002// RUN: clang-cc %s -fsyntax-only -fshort-wchar -verify -DSHORT_WCHAR
3
Chris Lattner7ec0bb62009-02-26 23:36:02 +00004#include <wchar.h>
John Thompsoned4e2952009-11-05 20:14:16 +00005
6#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
7 || defined(_M_X64) || defined(SHORT_WCHAR)
8 #define WCHAR_T_TYPE unsigned short
9#else
10 #define WCHAR_T_TYPE int
11#endif
12
Chris Lattner7ec0bb62009-02-26 23:36:02 +000013int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
John Thompsoned4e2952009-11-05 20:14:16 +000014
Chris Lattner7ec0bb62009-02-26 23:36:02 +000015void foo() {
John Thompsoned4e2952009-11-05 20:14:16 +000016 WCHAR_T_TYPE t1[] = L"x";
Chris Lattner7ec0bb62009-02-26 23:36:02 +000017 wchar_t tab[] = L"x";
John Thompsoned4e2952009-11-05 20:14:16 +000018 WCHAR_T_TYPE t2[] = "x"; // expected-error {{initialization}}
Chris Lattner7ec0bb62009-02-26 23:36:02 +000019 char t3[] = L"x"; // expected-error {{initialization}}
20}