[Bug c++/57555] Warning on negation of constexpr uint8_t being assigned to uint8_t

2013-06-08 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555 --- Comment #4 from Marc Glisse --- 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,

[Bug c++/57555] Warning on negation of constexpr uint8_t being assigned to uint8_t

2013-06-07 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555 Jonathan Wakely changed: What|Removed |Added Keywords||diagnostic Status|UNCONFIRM

[Bug c++/57555] Warning on negation of constexpr uint8_t being assigned to uint8_t

2013-06-07 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555 --- Comment #2 from Paolo Carlini --- Not having studied the issue in any detail, most likely the warning is fine: all the modern compilers (gcc, ICC, clang) I have at hand warn in exactly the same way.

[Bug c++/57555] Warning on negation of constexpr uint8_t being assigned to uint8_t

2013-06-07 Thread megari at mbnet dot fi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555 --- Comment #1 from Ari Sundholm --- It seems that actually just making the variable const suffices: uint8_t foo() { static const uint8_t foo = 0xff; uint8_t ret = ~foo; return ret; }