[cfe-commits] r64239 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def lib/Sema/SemaType.cpp test/Sema/array-constraint.c test/Sema/flexible-array-init.c

Douglas Gregor dgregor at apple.com
Tue Feb 10 14:51:27 PST 2009


On Feb 10, 2009, at 2:47 PM, Daniel Dunbar wrote:

> Agh! Do we really need to accept this!?
>
> What does f0 compute:
> --
> struct S0 {
>  int a;
>  int b[];
> };
>
> struct S1 {
>  struct S0 x;
>  struct S0 y;
> };
>
> int f0(struct S1 a) {
>  return a.y.b[0];
> }
> --
>
> I haven't studied this issue closely, but this seems to be a GNU
> extension which defies having any reasonable semantics.

It's also a GNU extension that seems to be used within FreeBSD.

We could upgrade this to a more strongly-worded EXTWARN, that says  
something to the effect of: the flexible array member can never safely  
have non-zero length. But, I don't think we can make this a hard  
error :(

	- Doug



More information about the cfe-commits mailing list