[Bug c++/62181] [C/C++] Expected new warning: "adding 'char' to a string does not append to the string" [-Wstring-plus-int]
ryxi at stu dot xidian.edu.cn
gcc-bugzilla@gcc.gnu.org
Wed Mar 15 06:51:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62181
Xi Ruoyao <ryxi at stu dot xidian.edu.cn> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ryxi at stu dot xidian.edu.cn
--- Comment #4 from Xi Ruoyao <ryxi at stu dot xidian.edu.cn> ---
In the recent version of clang this diagnostic was separated to two
warnings, -Wstring-plus-char and -Wstring-plus-int.
-Wstring-plus-char warns
"adding <char type> to a string pointer does not append to the string"
where <char type> may be char, unsigned char in C/C++, and char16_t,
char32_t, wchar_t in C++ 2011 and above.
-Wstring-plus-int warns
"adding <int type> to a string does not append to the string"
where the string is a literal and the integer is not a literal (like
Tobias showed in the description).
It's more clear to use two different options. But the two warnings may
be reported at the same location. It seems a little redundant. Should
we silence one while the other has been reported?
More information about the Gcc-bugs
mailing list