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