The compiler can freely store the value of const in read-only memory; it can make assumptions that it will never change during program optimization. If you drop the constant, you break the contract with the compiler, so technically everything can happen.
Actually, the compiler rarely does something that will be violated by const_cast-ing, but theoretically it is possible.
Michael J Jun 15 2018-12-15T00: 00Z
source share