Proposed resolution to aliasing issue.

Mark Mitchell mark@codesourcery.com
Wed May 11 20:36:00 GMT 2005


Wolfgang Bangerth wrote:

> I understand that you are talking about ISO C, but one relevant case (in C++) 
> to look out for that is similar is this one, which certainly constitutes 
> legitimate and widespread use of language features:
> 
>   class A {...};
>   class B : public A { ... };
> 
>   void f() {
>     B b;
>     g (static_cast<A*> (&b));
>   }
> 
>   void g(A *a) {
>     B *b = dynamic_cast<B*>(a);
>     // do what you please with the full object B
>   }

Yes, it was this example that is at the root of the whole thread. 
Everyone is agreed that in C++, when the "field" is in fact a base 
class, we must make the conservative assumption.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304



More information about the Gcc mailing list