[Bug c++/71912] [6/7 regression] flexible array in struct in union rejected
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 19 19:48:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71912
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |69698
Severity|normal |minor
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #4)
> Even though GCC with -Wpedantic silently accepts the equivalent definition
> of struct xyyzy, it issues a diagnostic for baz supporting the
> interpretation above:
>
> warning: invalid use of structure with flexible array member
>
> Since the struct definitions are equivalent, it seems that either they both
> should be diagnosed or neither should be.
Let me correct the above. GCC does give a pedantic warning in both cases
confirming that the test case is, strictly speaking, invalid. (I must have
missed it somehow.) Clang too diagnoses it with -Wflexible-array-extensions:
warning: 'u' may not be nested in a struct due to flexible array
I'm lowering the Severity to Minor but I will fix the C++ error for
compatibility with GCC.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69698
[Bug 69698] [meta-bug] flexible array members
More information about the Gcc-bugs
mailing list