[Bug c++/57599] g++ accepts invalid dynamic_cast of a const type to a regular type

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 12 16:35:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The summary is very misleading. You're not casting a const type to a non-const
type, you're casting a non-const type to a const type, then assigning that to a
non-const type.

What actually happens is that dynamic_cast<const A*>(b) returns A*



More information about the Gcc-bugs mailing list