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

--- Comment #4 from Yann Droneaud <yann at droneaud dot fr> ---
Also with the ({}) GCC extension:

    struct a {
        int b;
        int c;
    };

    void d(struct a *);

    void e(void) {

        struct a f = {
                         .b = ({
                                   int g = 0;
                                   g;
                              })
        };

        d(&f);
    }

It produces the warning:

    <source>: In function 'e':

    <source>:10:17: error: missing initializer for field 'c' of 'struct a'
[-Werror=missing-field-initializers]
       10 |                 })};
          |                 ^
    <source>:3:7: note: 'c' declared here
        3 |   int c;
          |       ^
    cc1: all warnings being treated as errors
    Compiler returned: 1

See https://godbolt.org/z/VJAuv4

(Note: this example and the one above were reduced by c-reduce
https://embed.cs.utah.edu/creduce/ )

Reply via email to