[Bug c++/69550] Need a way to disable "flexible array member in an otherwise empty struct" error on GCC 6
yyc1992 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 29 18:23:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69550
Yichao Yu <yyc1992 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yyc1992 at gmail dot com
--- Comment #17 from Yichao Yu <yyc1992 at gmail dot com> ---
I didn't write that code originally but I think I know why it is written this
way when trying to fix the compiler warning/errors.
What we want is basically,
```
struct _jl_value_t {
struct _jl_value_t *fieldptr[];
};
```
It needs to be a flexible array rather than an zero-length array since it will
cause a runtime error on OSX otherwise. (Ref
https://github.com/JuliaLang/julia/pull/13845 I don't have a mac to check but I
assume it is done by clang in certain debug mode).
However, this doesn't work since the struct mush have another (in priciple
non-empty) member and that's why we added a zero length array member in the
struct which is non-standard but seems to have worked around the compiler
warning on GCC < 6.
If this change is made intentionally in C++ mode, I'm fine with keeping it as
is given we've already fixed it on our master and it's easy enough (at least
for us) to work around this on our stable branch without breaking any existng
setup. I'm not sure if other projects will have the same problem though.
More information about the Gcc-bugs
mailing list