OSDN Git Service

(output_init_element): Constructor is not simple if a bitfield is
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Apr 1995 12:35:12 +0000 (12:35 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Apr 1995 12:35:12 +0000 (12:35 +0000)
being assigned a non-integer.

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

gcc/c-typeck.c

index fd0eae0..1873613 100644 (file)
@@ -5707,7 +5707,10 @@ output_init_element (value, type, field, pending)
     constructor_erroneous = 1;
   else if (!TREE_CONSTANT (value))
     constructor_constant = 0;
-  else if (initializer_constant_valid_p (value, TREE_TYPE (value)) == 0)
+  else if (initializer_constant_valid_p (value, TREE_TYPE (value)) == 0
+          || ((TREE_CODE (constructor_type) == RECORD_TYPE
+               || TREE_CODE (constructor_type) == UNION_TYPE)
+              && DECL_BIT_FIELD (field) && TREE_CODE (value) != INTEGER_CST))
     constructor_simple = 0;
 
   if (require_constant_value && ! TREE_CONSTANT (value))