修改非 mutable 常量对象
C++-Undefined-Behavior-52
示例:
struct T {
mutable int i;
int j;
};
const T obj {};
T* p = const_cast<T*>(&obj);
obj.i++; // Well-defined
obj.j++; // Ill-formed, compile error
p->i = 0; // Well-defined
p->j = 1; // Undefined behavior
依据
ISO/IEC 14882:2003 7.1.5.1(4)-undefined
ISO/IEC 14882:2011 7.1.6.1(4)-undefined