This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strenghten assumption about dynamic type changes (placement new)


> I don't see why
> 
> long x[1024];
> 
> Q *q = new (x) Q;
> q->~Q ();
> new (x) T;
> 
> would be invalid.  I also don't see why
> 
> Q q;
> q.~Q ();
> new (&q) T;
> 
> would be.  Object lifetime is precisely specified and I don't see where it is
> tied to (static) storage lifetime.

This is precisely the testcase I posted on beggining of this thread.

I do not see how the testcases can work with aliasing rules in the case Q's and T's
memory is known to not alias.

Either we need to define what is and is not supported or go for speculative devirt more often.

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]