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