[Bug c++/14827] Run time error, breaking of type info and static casts

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Fri Apr 2 23:30:00 GMT 2004


------- 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



More information about the Gcc-bugs mailing list