https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119987

            Bug ID: 119987
           Summary: RFE: promote -fms-extensions for structures to
                    -std=gnu*
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hpa at zytor dot com
  Target Milestone: ---

Being able to use an already predefined structure as an anonymous structure
member as permitted by -fms-extensions would be an incredibly useful feature in
general. For one thing, it would enabling cleaning up the Linux kernel UAPI
headers substantially. As it currently sits, the only way to create a structure
as an alias of another --never mind an extension thereof-- requires duplicating
the entire definition.

As this is already an implemented feature, it would be fantastic if this could
be enabled by default on all platforms.

I should probably point out that I have already recommended to the C committee
that this ought to be a standard feature. With both MSVC and gcc implementing
it, it ought to fall within the scope of getting included in C2y or C2z.

The specific features I am referring to are:

struct foo {
   int x, y;
};

struct bar {
   struct foo;
   int z;
};

... meaning struct bar should contain the members x, y, and z.

Reply via email to