[Bug c++/82711] -Wignored-qualifiers could be moved into -Wextra
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Oct 25 10:49:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82711
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'd argue it doesn't help readability at all if it makes the code appear to do
one thing but it actually does something different.
The warning has always been in -Wall for ignored qualifiers on return types,
and nobody complained, so we don't want to change that. Maybe I should have
added a separate option for ignoring qualifiers in casts. Intel ICC warns about
return types in -Wall but needs -Wextra for the warning about the cast here:
const int f(long i)
{
return static_cast<const int>(i);
}
1 : <source>(1): warning #858: type qualifier on return type is meaningless
const int f(long i)
^
3 : <source>(3): warning #191: type qualifier is meaningless on cast type
return static_cast<const int>(i);
^
Compiler exited with result code 0
Alternatively, maybe the world's C++ code just needs to get fixed to stop
writing things that have no meaning :-)
More information about the Gcc-bugs
mailing list