This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14827] Run time error, breaking of type info and static casts
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Apr 2004 23:30:10 -0000
- Subject: [Bug c++/14827] Run time error, breaking of type info and static casts
- References: <20040402225716.14827.Igor.Smirnov@cern.ch>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-04-02 23:30 -------
I can confirm this with all compiler up to and including mainline. And
also with Intel's icc7.
However, your code is invalid. When you cast to void*, the compiler
loses track of where the Derived part of your SuperDerived object
resides. Then, when you cast back from void*, the compiler has to
assume that this cast does not need any pointer adjustment. There is
simply no way the compiler can do what you want in view of this. You
can't cast to void* and expect the compiler to work with this correctly.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14827