diff options
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 46f352b..46863ed 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5018,11 +5018,20 @@ finish_struct (tree t, tree fieldlist, tree attributes) && TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (x))) == NULL_TREE) { if (TREE_CODE (t) == UNION_TYPE) - error ("%Jflexible array member in union", x); + { + error ("%Jflexible array member in union", x); + TREE_TYPE (x) = error_mark_node; + } else if (TREE_CHAIN (x) != NULL_TREE) - error ("%Jflexible array member not at end of struct", x); + { + error ("%Jflexible array member not at end of struct", x); + TREE_TYPE (x) = error_mark_node; + } else if (! saw_named_field) - error ("%Jflexible array member in otherwise empty struct", x); + { + error ("%Jflexible array member in otherwise empty struct", x); + TREE_TYPE (x) = error_mark_node; + } } if (pedantic && TREE_CODE (t) == RECORD_TYPE |