https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96996
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- const_cast lets you add/remove cv-qualifiers from pointers and references, but that doesn't make it OK to write to an object that was originally defined as const. Similar to how reinterpret_cast from int* to float* doesn't make it OK to violate TBAA rules. You can change the type, but that doesn't mean it's safe to use.