This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Allow relayout_decl on FIELD_DECLs (PR c/72816)


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.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]