This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug objc/47832] [4.6 Regression] ObjC errors on structures with flexible data members
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 Feb 2011 12:03:16 +0000
- Subject: [Bug objc/47832] [4.6 Regression] ObjC errors on structures with flexible data members
- Auto-submitted: auto-generated
- References: <bug-47832-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47832
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-21 12:02:58 UTC ---
As I said, I don't know ObjC, so if you could fix it, I'd appreciate it.
That said, ISO C99 allows:
struct A { int a; char b[]; };
struct A a; // Here sizeof (a) will be offsetof (struct A, b[0])
but doesn't allow:
struct B { struct A a; int i; };
So, for ObjC I guess it depends if in @interface there are variables (then
variables with flexible array members in theory could be treated there like ISO
C99 treats variables), or they are treated as struct fields, in which cases
fields with flex array members should be rejected. And you're right that it is
weird to reject there pointers to structs with flexible array members, unless
ObjC somehow encodes all the types each pointer points to, transitively.