Date: Fri, 17 Jul 2026 04:22:37 +0000
Looks like this is a known bug in GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72751
> On Jul 16, 2026, at 20:59, Russell Shaw via Std-Discussion <std-discussion_at_[hidden]> wrote:
>
> Hi,
>
> [class.union.anon] says "Nested types, anonymous unions, and functions
> shall not be declared within an anonymous union."
>
> It seems pretty definite. Everywhere i read and g++ allows them.
>
> struct A {
>
> union {
> union {
> int x;
> };
> };
>
> A() {
> int a = x;
> }
> };
>
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>
> On Jul 16, 2026, at 20:59, Russell Shaw via Std-Discussion <std-discussion_at_[hidden]> wrote:
>
> Hi,
>
> [class.union.anon] says "Nested types, anonymous unions, and functions
> shall not be declared within an anonymous union."
>
> It seems pretty definite. Everywhere i read and g++ allows them.
>
> struct A {
>
> union {
> union {
> int x;
> };
> };
>
> A() {
> int a = x;
> }
> };
>
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>
Received on 2026-07-17 04:22:41
