Hello, Does the below code look like valid C++, or is it a G++ bug? 5.2.7 has <...> The dynamic_cast operator shall not cast away constness (5.2.11).The other compilers I could check quickly (clang, icc, msvc) all reject the code, GCCs 3.3, 4.6, 4.7 and 4.8 accept the code.
Andrey class A { }; class B : public A { }; int main() { A* a; B* b = new B(); a = dynamic_cast<const A*>(b); return 0; }