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

qinzhao at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qinzhao at gcc dot gnu.org

--- Comment #2 from qinzhao at gcc dot gnu.org ---
(In reply to Richard Biener from comment #1)
> > ./cc1 -quiet t.c -pedantic-errors
> t.c:7:6: error: invalid use of structure with flexible array member
> [-Wpedantic]
>     7 |   F2 flex;
>       |      ^~~~
> 
> so this is supposedly a GCC extension, treating [] as [0] in this context?

I found this in the gcc doc:

https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html#Zero-Length

"A structure containing a flexible array member, or a union containing such a
structure (possibly recursively), may not be a member of a structure or an
element of an array. (However, these uses are permitted by GCC as extensions.)"

Looks like this usage is permitted by GCC extensions.

However, cannot find the details in the doc on how GCC treat these usage.

Reply via email to