diff options
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/c-typeck.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 54cb60c..249311a 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -5518,10 +5518,12 @@ output_init_element (value, type, field, pending) digest_init (type, value, 0, 0), constructor_pending_elts); } - else if ((TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) + else if (TREE_CODE (constructor_type) == RECORD_TYPE && field != constructor_unfilled_fields) { + /* We do this for records but not for unions. In a union, + no matter which field is specified, it can be initialized + right away since it starts at the beginning of the union. */ if (!duplicate) constructor_pending_elts = tree_cons (field, |
