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

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Mon Apr 5 13:34:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-04-05 13:34 -------
Covariant return types are implemented in the upcoming 3.4. However, 
they have nothing to do with your problem. 
 
Really, you have to understand that a cast can change the representation 
of a pointer. One example is when you have a pointer to a derived class 
which has two base classes. Casting to one of them must change the 
pointer, since the two base classes cannot be at the same memory 
location. This is also the reason for the thing Giovanni quotet: when 
you cast to void*, the _only_ thing that you can do with this pointer 
is to cast it back to the _exact same_ type. You did not do that, so that's 
where your error lies. 
 
Please read up on this somewhere. 
 
W. 

-- 


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



More information about the Gcc-bugs mailing list