Modifying a const object via a non-const lvalue is undefined behaviour.Is there a flag to forbid that ?It's always forbidden, but it cannot always be detected
It's not forbidden, it's undefined behaviour, duh. The compiler warns for this; the warning cannot be turned off. Also, the only way to turn it into an error is -Werror it seems, which will turn _all_ warnings into errors. Segher