This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Allow relayout_decl on FIELD_DECLs (PR c/72816)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, Richard Biener <rguenther at suse dot de>, <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 8 Aug 2016 11:04:32 +0000
- Subject: Re: [PATCH] Allow relayout_decl on FIELD_DECLs (PR c/72816)
- Authentication-results: sourceware.org; auth=none
- References: <20160806190908.GB14857@tucnak.redhat.com>
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