On Tue, Feb 19, 2019 at 4:00 AM Jakub Jelinek <ja...@redhat.com> wrote:
> On Mon, Feb 18, 2019 at 03:01:14PM -1000, Jason Merrill wrote:
> > But it's not clear to me that the standard actually allows this.  I don't
> > think changing the active member of a union in the mem-initializer for
> > another member is reasonable.
>
> There is in [expr.const]/2:
>
> an lvalue-to-rvalue conversion (7.1) that is applied to a glvalue that refers 
> to a non-active member of a
> union or a subobject thereof;
>
> an assignment expression (8.18) or invocation of an assignment operator 
> (15.8) that would change the
> active member of a union;
>
> in C++17 it seems, so maybe my union testcases are accepts-invalid.
> This has been introduced in P0137R1 and removed again in P1330R0.  Does that
> mean e.g. following is valid in C++14, invalid in C++17 and valid again in
> C++20?  Or has one of the above papers changed retroactively previous
> standards?

Before P0137 I believe foo and bar were arguably undefined.

Jason

Reply via email to