c-typeck.c (convert_for_assignment): Use the type of the member for the initialization.
authorRichard Guenther <rguenther@suse.de>
Mon, 20 Aug 2007 11:41:30 +0000 (11:41 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 20 Aug 2007 11:41:30 +0000 (11:41 +0000)
2007-08-20  Richard Guenther  <rguenther@suse.de>

        * c-typeck.c (convert_for_assignment): Use the type of
        the member for the initialization.

From-SVN: r127646

gcc/ChangeLog
gcc/c-typeck.c

index 4ce1dd6c650c2d063db3cbbb425151c293518a04..35822ba7e9fddfb8aa71790eb0678245bb7a092d 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-20  Richard Guenther  <rguenther@suse.de>
+
+        * c-typeck.c (convert_for_assignment): Use the type of
+        the member for the initialization.
+
 2007-08-20  Richard Guenther  <rguenther@suse.de>
 
        * c-objc-common.c (c_disregard_inline_limits): Remove.
index d793f72ab59dd7a77618b3342953e9e28a5395f2..3ef07b5823ed33e245d2fed371e45527c19c7bd5 100644 (file)
@@ -4039,6 +4039,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
          if (pedantic && (!fundecl || !DECL_IN_SYSTEM_HEADER (fundecl)))
            pedwarn ("ISO C prohibits argument conversion to union type");
 
+         rhs = fold_convert (TREE_TYPE (memb), rhs);
          return build_constructor_single (type, memb, rhs);
        }
     }