diff options
| author | Hans Wennborg <hans@hanshq.net> | 2013-05-15 11:03:04 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2013-05-15 11:03:04 +0000 |
| commit | 8f62c5ca22f496021148f6c3b6a53c7115c31950 (patch) | |
| tree | e9368c21b7e2ad04c400473198614b36e64874ba /clang/test/Lexer | |
| parent | 78a8ef87ca001d18df541e3b8f38ed373563e8b1 (diff) | |
| download | bcm5719-llvm-8f62c5ca22f496021148f6c3b6a53c7115c31950.tar.gz bcm5719-llvm-8f62c5ca22f496021148f6c3b6a53c7115c31950.zip | |
Better diagnostics for string initialization.
This commit improves Clang's diagnostics for string initialization.
Where it would previously say:
/tmp/a.c:3:9: error: array initializer must be an initializer list
wchar_t s[] = "Hi";
^
/tmp/a.c:4:6: error: array initializer must be an initializer list or string literal
char t[] = L"Hi";
^
It will now say
/tmp/a.c:3:9: error: initializing wide char array with non-wide string literal
wchar_t s[] = "Hi";
^
/tmp/a.c:4:6: error: initializing char array with wide string literal
char t[] = L"Hi";
^
As a bonus, it also fixes the fact that Clang would previously reject
this valid C11 code:
char16_t s[] = u"hi";
char32_t t[] = U"hi";
because it would only recognize the built-in types for char16_t and
char32_t, which do not exist in C.
llvm-svn: 181880
Diffstat (limited to 'clang/test/Lexer')
| -rw-r--r-- | clang/test/Lexer/char-literal.cpp | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/clang/test/Lexer/char-literal.cpp b/clang/test/Lexer/char-literal.cpp index b2fab34e440..1cd14a9b011 100644 --- a/clang/test/Lexer/char-literal.cpp +++ b/clang/test/Lexer/char-literal.cpp @@ -36,8 +36,4 @@ char16_t p[2] = u"\U0000FFFF"; 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 |

