Hans Wennborg | 15f92ba | 2013-05-10 10:08:40 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions -triple i386-pc-win32 %s |
| 2 | |
| 3 | // C++ mode with -fno-wchar works the same as C mode for wchar_t. |
| 4 | // RUN: %clang_cc1 -x c++ -fno-wchar -fsyntax-only -verify -fms-extensions -triple i386-pc-win32 %s |
| 5 | |
| 6 | wchar_t f(); // expected-error{{unknown type name 'wchar_t'}} |
| 7 | |
| 8 | // __wchar_t is available as an MS extension. |
| 9 | __wchar_t g = L'a'; // expected-note {{previous}} |
| 10 | |
| 11 | // __wchar_t is a distinct type, separate from the target's integer type for wide chars. |
| 12 | unsigned short g; // expected-error {{redefinition of 'g' with a different type: 'unsigned short' vs '__wchar_t'}} |
| 13 | |
| 14 | // The type of a wide string literal is actually not __wchar_t. |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 15 | __wchar_t s[] = L"Hello world!"; // expected-error-re {{array initializer must be an initializer list{{$}}}} |
Hans Wennborg | 0ff5074 | 2013-05-15 11:03:04 +0000 | [diff] [blame] | 16 | |
| 17 | // Do not suggest initializing with a string here, because it would not work. |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 18 | __wchar_t t[] = 1; // expected-error-re {{array initializer must be an initializer list{{$}}}} |