This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/72753] New: sole flexible array member in a typedef 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: Fri, 29 Jul 2016 21:37:11 +0000
- Subject: [Bug c++/72753] New: sole flexible array member in a typedef rejected
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72753
Bug ID: 72753
Summary: sole flexible array member in a typedef rejected
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
The following program defines two structs whose only member is a flexible
array. Such types are invalid and should be rejected. G++ diagnoses the one
defined in the named struct but fails to diagnose the one in the unnamed
struct.
$ cat t.C && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -S -Wall
-Wextra -Wpedantic t.C
struct A {
int a[];
};
typedef struct {
int a[];
} B;
t.C:2:9: error: flexible array member ‘A::a’ in an otherwise empty ‘struct A’
int a[];
^
t.C:1:8: note: in the definition of ‘struct A’
struct A {
^