void foo(int *x) { *x++; } void bar(const int *x) { foo(x); // compiler error foo(const_cast(x)); // succeeds } main() { int x = 7; bar(&x); }