C++17 std::launder and aliasing
Jakub Jelinek
jakub@redhat.com
Mon Oct 24 12:04:00 GMT 2016
On Mon, Oct 24, 2016 at 02:01:12PM +0200, Richard Biener wrote:
> Ok, so with two std::launder (&a) and launder being CONST we'd happily
> CSE them. Which means repeatedly laundering &a wouldn't work. You'd
> have to do
>
> A *p = std::launder (&a)->g();
> A *q = std::launder(p)->f();
> std::launder (q)->g();
> ...
I agree CSEing std::launder is undesirable, not in the testcase I've posted,
there it is just fine, but in others. So I'll test with ECF_LEAF | ECF_NOTHROW.
>
> ?
>
> > > int e = std::launder(&a)->f();
> > > if(b != 2 || c != 1 || d != 1 || f != 1)
> > > std::abort();
> > > }
> > >
> > > Jakub
> >
> >
>
> --
> Richard Biener <rguenther@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
Jakub
More information about the Libstdc++
mailing list