const int value2 = 12;
value2
is a compile-time constant. The compiler can easily (and has to) prove that the value is 12 which happens to be within the range of values representable by char
.
int value1 = 12;
value1
is not a compile-time constant. The value of the variable could change at runtime.
The exact wording of the standard rule (quoting latest draft, emphasis added):
[dcl.init.list]/7
A narrowing conversion is an implicit conversion
- from an integer type or unscoped enumeration type to an integer type that cannot represent all the values of the original type, except where the source is a constant expression whose value after integral promotions will fit into the target type.