Aliasing 'this' in a C++ constructor

Jason Merrill jason@redhat.com
Fri May 18 13:50:00 GMT 2018


On Fri, May 18, 2018 at 8:34 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Fri, 18 May 2018, Richard Biener wrote:
>> On Fri, May 18, 2018 at 2:25 PM Marc Glisse <marc.glisse@inria.fr> wrote:
>>
>>> this lets alias analysis handle the implicit 'this' parameter in C++
>>> constructors as if it was restrict.
>>
>> OK.  Please give C++ folks the chance to chime in on the semantics.
>
> (Cc: said C++ folks)

I suppose it's technically valid to write something like

void f()
{
  A a;
  a.~A();
  new (&a) A(a);
}

but that's pretty pathological and useless, so I'm not concerned about
messing with it.

Jason



More information about the Gcc-patches mailing list