This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71912] [6/7 regression] flexible array in struct in union rejected


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]