diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-03-09 23:56:02 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-03-09 23:56:02 +0000 |
commit | 0093e12513c5c896434915d5e9126f51b780aa61 (patch) | |
tree | 4ba4f0eaf849ce25a1e9b23f1876f4a5c4201a9a /test/Lexer/char-literal.cpp | |
parent | 0b91cc47a5642de2e1f567fe0f29420acdcdebbe (diff) | |
download | clang-0093e12513c5c896434915d5e9126f51b780aa61.tar.gz |
When lexing in C11 mode, accept unicode character and string literals, per C11
6.4.4.4/1 and 6.4.5/1.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Lexer/char-literal.cpp')
-rw-r--r-- | test/Lexer/char-literal.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/Lexer/char-literal.cpp b/test/Lexer/char-literal.cpp index 8556d468cb..b2fab34e44 100644 --- a/test/Lexer/char-literal.cpp +++ b/test/Lexer/char-literal.cpp @@ -1,4 +1,11 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -Wfour-char-constants -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c11 -x c -Wfour-char-constants -fsyntax-only -verify %s + +#ifndef __cplusplus +typedef __WCHAR_TYPE__ wchar_t; +typedef __CHAR16_TYPE__ char16_t; +typedef __CHAR32_TYPE__ char32_t; +#endif int a = 'ab'; // expected-warning {{multi-character character constant}} int b = '\xFF\xFF'; // expected-warning {{multi-character character constant}} @@ -7,7 +14,9 @@ int c = 'APPS'; // expected-warning {{multi-character character constant}} char d = '⌘'; // expected-error {{character too large for enclosing character literal type}} char e = '\u2318'; // expected-error {{character too large for enclosing character literal type}} +#ifdef __cplusplus auto f = '\xE2\x8C\x98'; // expected-warning {{multi-character character constant}} +#endif char16_t g = u'ab'; // expected-error {{Unicode character literals may not contain multiple characters}} char16_t h = u'\U0010FFFD'; // expected-error {{character too large for enclosing character literal type}} @@ -24,4 +33,11 @@ char32_t n = U'ab'; // expected-error {{Unicode character literals may not conta char16_t o = '👽'; // expected-error {{character too large for enclosing character literal type}} char16_t p[2] = u"\U0000FFFF"; -char16_t q[2] = u"\U00010000"; // expected-error {{too long}} +char16_t q[2] = u"\U00010000"; +#ifdef __cplusplus +// expected-error@-2 {{too long}} +#else +// FIXME: The above should be accepted in C11 mode. +// expected-error@-6 {{must be an initializer list}} +// expected-error@-6 {{must be an initializer list}} +#endif |