Unexpected (IMO) constant-conversion warning

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 disappears.

Could someone explain it to me?

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 that phrase you’ll find a more detailed description) and then the arithmetic is done. So there’s an implicit widening from uint8_t to int of the ‘a’ before the ~ is done. So you have to cast back down.