This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/59855] Support sparse-style __attribute__((designated_init)) on structures, requiring designated initializers


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

--- Comment #5 from Josh Triplett <josh at joshtriplett dot org> ---
(In reply to Tom Tromey from comment #4)
> Implemented on trunk.

Thanks!

Please consider including anonymous structs and unions in the test case as
well:

struct S {
    int a;
    union {
        int b;
        int c;
    };
} __attribute__((designated_init));

static struct S s = {
    .a = 0,
    .b = 0,
};

union U {
    int a;
    struct {
        int b;
        int c;
    }  __attribute__((designated_init));
};

static union U u = {
    .b = 0,
    .c = 0,
};

Both of the cases above should produce no warnings; analogous positional
initializers should produce warnings.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]