[Bug c++/69550] New: Need a way to disable "flexible array member in an otherwise empty struct" error on GCC 6

nalimilan at club dot fr gcc-bugzilla@gcc.gnu.org
Fri Jan 29 10:45:00 GMT 2016


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

            Bug ID: 69550
           Summary: Need a way to disable "flexible array member in an
                    otherwise empty struct" error on GCC 6
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nalimilan at club dot fr
  Target Milestone: ---

Created attachment 37514
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37514&action=edit
Test C++ program which compiles with GCC 5 but not with GCC 6

GCC 6 has become stricter than GCC 5 as regards having two flexible array
members in a struct with no other fields. In GCC 5, the attached test program
used to compile fine. It only triggered a warning with -Wpedantic. In GCC 6, it
triggers an error with all -std modes.

While this is arguably against the standard, the fact that this code was
accepted before and not in GCC 6 is a problem when the public API of a library
includes such a construct: the library cannot be built with GCC 6 without
breaking the API. This is the case for Julia [1].

Would it be possible to provide a way to turn the error into a warning? For
example, -std=gnu++11 could allow this, while -std=c++11 would still consider
it as an error.



1: https://github.com/JuliaLang/julia/pull/14829


More information about the Gcc-bugs mailing list