On Fri, Jul 30, 2021 at 01:10:33AM -0400, Jason Merrill wrote:
> > It also shows that in the case (we're beyond the standard in this case
> > because anonymous structures are not in the standard) of union with
> > non-std-layout anonymous structure in it, in the case in the testcases like:
> > struct D {};
> > struct E { [[no_unique_address]] D e; };
> > union Y { int a; struct : public E { short b; long c; }; long long d; };
> 
> We don't already reject an anonymous struct with bases?  I think we should
> do so, in fixup_anonymous_aggr.  We might even require anonymous structs to
> be standard-layout.

Not having base classes seems reasonable requirement for the anonymous
structures, after all, I couldn't find a way to refer to the members
in the base class - &Y::e is rejected with the above.
But standard layout means that even all the non-static members of the struct
need to be standard-layout, that seems an unnecessary requirement for
anon structures to me.

        Jakub

Reply via email to