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 | 0ff5074f37a66bca244a9d5d0da050ff68693ce2 (patch) | |
| tree | 9c977823d274f1827c9c00fd0c3521eb03c6e444 /lib/CodeGen/CodeGenFunction.cpp | |
| parent | 33f4b90476f24d269cac04915d951d8f05bd3a77 (diff) | |
| download | clang-0ff5074f37a66bca244a9d5d0da050ff68693ce2.tar.gz clang-0ff5074f37a66bca244a9d5d0da050ff68693ce2.tar.bz2 clang-0ff5074f37a66bca244a9d5d0da050ff68693ce2.tar.xz | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181880 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions
