1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -Wfour-char-constants -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c11 -x c -Wfour-char-constants -fsyntax-only -verify %s
3 
4 #ifndef __cplusplus
5 typedef __WCHAR_TYPE__ wchar_t;
6 typedef __CHAR16_TYPE__ char16_t;
7 typedef __CHAR32_TYPE__ char32_t;
8 #endif
9 
10 int a = 'ab'; // expected-warning {{multi-character character constant}}
11 int b = '\xFF\xFF'; // expected-warning {{multi-character character constant}}
12 int c = 'APPS'; // expected-warning {{multi-character character constant}}
13 
14 char d = '⌘'; // expected-error {{character too large for enclosing character literal type}}
15 char e = '\u2318'; // expected-error {{character too large for enclosing character literal type}}
16 
17 #ifdef __cplusplus
18 auto f = '\xE2\x8C\x98'; // expected-warning {{multi-character character constant}}
19 #endif
20 
21 char16_t g = u'ab'; // expected-error {{Unicode character literals may not contain multiple characters}}
22 char16_t h = u'\U0010FFFD'; // expected-error {{character too large for enclosing character literal type}}
23 
24 wchar_t i = L'ab'; // expected-warning {{extraneous characters in character constant ignored}}
25 wchar_t j = L'\U0010FFFD';
26 
27 char32_t k = U'\U0010FFFD';
28 
29 char l = 'Ø'; // expected-error {{character too large for enclosing character literal type}}
30 char m = '��'; // expected-error {{character too large for enclosing character literal type}}
31 
32 char32_t n = U'ab'; // expected-error {{Unicode character literals may not contain multiple characters}}
33 char16_t o = '��'; // expected-error {{character too large for enclosing character literal type}}
34 
35 char16_t p[2] = u"\U0000FFFF";
36 char16_t q[2] = u"\U00010000";
37 #ifdef __cplusplus
38 // expected-error@-2 {{too long}}
39 #endif
40