[Bug c/84500] New: diagnostic says "array of chars" for arrays of wchar_t, char16_t and char32_t
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 21 13:48:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84500
Bug ID: 84500
Summary: diagnostic says "array of chars" for arrays of
wchar_t, char16_t and char32_t
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
#include <stddef.h>
#include <uchar.h>
int main() {
wchar_t w[3] = L"abcd";
char16_t u16[3] = u"abcd";
char32_t u32[3] = U"abcd";
}
a.c: In function ‘main’:
a.c:4:18: warning: initializer-string for array of chars is too long
wchar_t w[3] = L"abcd";
^~~~~~~
a.c:5:21: warning: initializer-string for array of chars is too long
char16_t u16[3] = u"abcd";
^~~~~~~
a.c:6:21: warning: initializer-string for array of chars is too long
char32_t u32[3] = U"abcd";
^~~~~~~
Also:
/* { dg-options "-Wc++-compat" } */
#include <stddef.h>
int main() {
char c[3] = "abc";
wchar_t w[3] = L"abc";
}
a.c: In function ‘main’:
a.c:4:15: warning: initializer-string for array chars is too long for C++
[-Wc++-compat]
char c[3] = "abc";
^~~~~
a.c:5:18: warning: initializer-string for array chars is too long for C++
[-Wc++-compat]
wchar_t w[3] = L"abc";
^~~~~~
Note "array chars" not "array of chars".
More information about the Gcc-bugs
mailing list