https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88261
--- Comment #10 from Bernd Edlinger <edlinger at gcc dot gnu.org> --- Hmm, there are a few loose ends, where there is simply no decl. For instance in this example: /* PR c/5597 */ /* { dg-do compile } */ /* { dg-options "" } */ /* Verify that GCC forbids non-static initialization of flexible array members. */ struct str { int len; char s[]; }; struct str a = { 2, "a" }; void foo() { static struct str d = (struct str) { 2, "d" }; /* { dg-error "(non-static)|(near initialization)" } */ static struct str e = (struct str) { d.len, "e" }; /* { dg-error "(non-static)|(initialization)" } */ } $ g++ -S array-6.c array-6.c:14:47: error: non-static initialization of a flexible array member 14 | static struct str d = (struct str) { 2, "d" }; /* { dg-error "(non-static)|(near initialization)" } */ | ^ array-6.c:15:51: error: non-static initialization of a flexible array member 15 | static struct str e = (struct str) { d.len, "e" }; /* { dg-error "(non-static)|(initialization)" } */ | ^ the patch prints an error, but digest_init_r is called from finish_compound_literal: 2830 compound_literal = digest_init_flags (type, compound_literal, LOOKUP_NORMAL, 2831 complain, NULL_TREE); So here it is impossible to tell which decl is going to be initialized, because this is called drectly from the parser (cp_parser_postfix_expression). However the C-FE does also not have a decl here, and I think I cannot do much about that: $ gcc -S array-6.c array-6.c: In function 'foo': array-6.c:14:43: error: non-static initialization of a flexible array member 14 | static struct str d = (struct str) { 2, "d" }; /* { dg-error "(non-static)|(near initialization)" } */ | ^~~ array-6.c:14:43: note: (near initialization for '(anonymous)') array-6.c:15:47: error: non-static initialization of a flexible array member 15 | static struct str e = (struct str) { d.len, "e" }; /* { dg-error "(non-static)|(initialization)" } */ | ^~~ array-6.c:15:47: note: (near initialization for '(anonymous)') array-6.c:15:25: error: initializer element is not constant 15 | static struct str e = (struct str) { d.len, "e" }; /* { dg-error "(non-static)|(initialization)" } */ | ^