OSDN Git Service

(output_init_element): When initializing a union,
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Oct 1993 23:24:47 +0000 (23:24 +0000)
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Oct 1993 23:24:47 +0000 (23:24 +0000)
do it right away: never put the field on the pending list.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@5844 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-typeck.c

index 54cb60c..249311a 100644 (file)
@@ -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,