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

--- Comment #6 from Richard Henderson <rth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)
> Isn't that just because in C++ empty structs are forced by the FE into
> having length of one byte?

Yes, of course.

> I mean, if you:
> struct S {};
> int a = sizeof (struct S);
> struct S b;
> then in C it is int a = 0; and b is a common with zero size...

The zero-sized data thing is a rather useless GCC extension, IMO.
If you use -pedantic you will of course error out.

> So, for go, the question is if it follows GNU C or C++ for
> empty structs.

Since Go doesn't really have pointers in the usual sense, it's
difficult to ask the question "&a[1] != &a[2]".  Which *must* be
false for C++ and will be true for the GCC extension.

This does need a Go expert to figure out if there's another case
which can be determined from the language level.

Reply via email to