This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36971] Portability issue from gcc 2.96 to gcc 4.1.1 for c++ casting
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Aug 2008 23:28:52 -0000
- Subject: [Bug c++/36971] Portability issue from gcc 2.96 to gcc 4.1.1 for c++ casting
- References: <bug-36971-16528@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-08-10 23:28 -------
>d *ptr = reinterpret_cast<d*> (c1);
You are violating C/C++ aliasing rules as *c1 here is a c and not a d. Even
though d inherits from c, this is undefined behavior still as it is not the
opposite way around.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36971