[cfe-commits] r113018 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/flexible-array-test.cpp
Anders Carlsson
andersca at mac.com
Wed Sep 8 19:12:30 PDT 2010
Sep 6, 2010 kl. 9:49 PM skrev Francois Pichet:
> Any reason to to disallow flexible array element in union?
> Both gcc 4.5 and msvc allow it. For example:
> struct A
> {
> int Length;
> union
> {
> char dataC[];
> short dataS[];
> long dataL[];
> };
> };
>
Hi Francois,
the reason for it was that it doesn't make sense to have a single union with a flexible array element, for example:
union A {
int a;
char[] b;
};
but I definitely agree that having them in unions is OK as long as they're nested inside another struct (and all fields are flexible array members etc).
- Anders
More information about the cfe-commits
mailing list