[Bug c++/53762] pointer-casts don't always check null-pointers

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jun 24 16:31:00 GMT 2012


--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-24 16:30:54 UTC ---
These are allowed:

  pa = static_cast<A*>(pb);
  pb = static_cast<B*>(pa);

All the other casts are not because they involve dereferencing a null pointer
which is not allowed by [expr.unary.op]/1

Also, GCC  4.2 is not supported or maintained so there's no point reporting
bugs against it, you should check a newer release before reporting bugs.

More information about the Gcc-bugs mailing list