Namespaces
Variants

Talk:cpp/language/const cast

From cppreference.com

I've been told that casting away constness via const_cast in particular situations results in undefined behaviour. Even the example on this article mentions UB.

Yet the article does not say when exactly does const_cast invoke UB. Shouldn't it enumerate such cases?

const_cast never results in undefined behavior, but modifying a const lvalue does. I added a note. --Cubbi (talk) 14:29, 30 December 2015 (PST)