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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
            Summary|C2x:static compound literal |[13/14 Regression]
                   |(with flexible array) in    |C2x:static compound literal
                   |initializer leads to        |(with flexible array) in
                   |invalid size and ICE        |initializer leads to
                   |                            |invalid size and ICE
   Last reconfirmed|                            |2023-05-12
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
With:
```
    struct s { int i; char c[]; };
    const struct s *t = &(struct s) { .c = "2", };
```
GCC 12 used to reject it:
<source>:3:44: error: non-static initialization of a flexible array member
    3 |     const struct s *t = &(struct s) { .c = "2", };
      |                                            ^~~
<source>:3:44: note: (near initialization for '(anonymous)')


Note I think the ICE would happen in GCC 13 with checking enabled too.

Reply via email to