Basically:
struct foo_1
{
int flexible_guy[0]; // this works
};
struct foo_2
{
int flexible_guy[]; // this doesn't (error: flexible array member in a struct with no named members)
};
Is this the intended logic for some reason, an easter egg workaround for something not supported, or a compiler bug?
I'm using GCC 7.5.0 on Ubuntu 18.04, but I get the same result on a web compiler that uses GCC 9.4.0 (https://onlinegdb.com/_15wOU3UF).
gcc supports zero length arrays as an extension, which is why the first one is allowed.
https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.htm
The second case doesn't fall under this extension, so it falls back on what the C standard states, which doesn't allow an array with unspecified size in a struct as the only member.
From section 6.7.2.1p3 of the C standard regarding Struct and Union Specifiers under the Constraints heading:
The above gcc page on zero length arrays also mentions this: