Why is the following?:
const int i0 = 5;
//int i1 = const_cast(i0); // compilation error
int i2 = (int)i0;
For the first error. const_cast can only be used on pointer or reference types. "int" is neither. This may or may not be the C++ standard (couldn't find a good reference). But it is the case for certain implementations such as MS's C++ compiler.
For the second error. const_cast can only be used to remove a const or volatile qualifier not add it.
Reference: http://msdn.microsoft.com/en-us/library/bz6at95h(VS.80).aspx