On Mon, Aug 08, 2016 at 11:04:32AM +0000, Joseph Myers wrote:
> On Sat, 6 Aug 2016, Jakub Jelinek wrote:
> 
> > --- gcc/testsuite/gcc.dg/pr72816.c.jj       2016-08-06 13:06:45.046003282 
> > +0200
> > +++ gcc/testsuite/gcc.dg/pr72816.c  2016-08-06 13:07:57.217093845 +0200
> > @@ -0,0 +1,9 @@
> > +/* PR c/72816 */
> > +/* { dg-do compile } */
> > +/* { dg-options "-std=gnu11" } */
> > +
> > +typedef const int A[];
> > +struct S {
> > +  int a;
> > +  A b;     /* { dg-error "array size missing" } */
> > +};
> 
> As far as I can tell, this is actually valid code that should not produce 
> an error; the type of a flexible array member can be given by a typedef, 
> and I see nothing to disallow it being given by a typedef for an array of 
> qualified type.  Note that both the version of this test without const, 
> and the version with const but not using a typedef, are accepted.

I was looking into this last week a bot and the problem seems to be that for
typedefs the array 'b' doesn't have TYPE_DOMAIN, so its type is in fact
const int b[<unknown>] (so the code tries to deduce the size of the array
which fails) whereas without typedef the type is const int b[0:].  I thought
this discrepancy was the core issue here.

        Marek

Reply via email to