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