28 ms·
'value' is a const qualified object, not a const qualified reference. If you cast away the const and write to the object you are into UB, ergo the compiler can
by gpderetta 10y ago
'value' is a const qualified object, not a const qualified reference. If you cast away the const and write to the object you are into UB, ergo the compiler can assume that isn't done.
Note that the trick still doesn't help much in practice: GCC conservatively still won't optimize based on const qualification of values.