[Bug c++/57555] Warning on negation of constexpr uint8_t being assigned to uint8_t
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Jun 8 15:55:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555
--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
The warning is correct, but it is arguably unhelpful in this case, which is
made worse by the fact that -Woverflow is enabled by default. We do not warn
for
uint8_t ret = 0;
ret += ~foo;
with -Wall -Wextra, which is quite similar.
Changing this behavior would be hard, since when we emit the warning we have
forgotten where the constant was coming from.
bar doesn't warn because the constant would fit the signed type corresponding
to uint8_t (int8_t), a heuristic to reduce the noise produced by this warning.
More information about the Gcc-bugs
mailing list