This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71912] [6/7 regression] flexible array in struct in union rejected
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 19 Jul 2016 19:48:08 +0000
- Subject: [Bug c++/71912] [6/7 regression] flexible array in struct in union rejected
- Auto-submitted: auto-generated
- References: <bug-71912-4@http.gcc.gnu.org/bugzilla/>
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