Re: [cfe-users] Unexpected (IMO) constant-conversion warning

2018-06-25 Thread David Blaikie via cfe-users
Yeah, the problem is that '~a' is an expression of type 'int' due to something called "the usual arithmetic conversions" - basically in almost any arithmetic expression in C++, all the smaller int types get promoted up to int (this is oversimplifying a bit - but sufficient here - if you look up tha

[cfe-users] Unexpected (IMO) constant-conversion warning

2018-06-20 Thread Szymon Zimnowoda via cfe-users
Hello, consider following code: https://godbolt.org/g/UN8xTy I do not understand, why overflow warning is here, there is no explicite int in this code. When removing constexpr, warning disappears, when changing to: static constexpr uint8_t b = uint8_t{~a}; warning