diff options
author | rms <rms@138bc75d-0d04-0410-961f-82ee72b054a4> | 1993-08-06 07:08:12 +0000 |
---|---|---|
committer | rms <rms@138bc75d-0d04-0410-961f-82ee72b054a4> | 1993-08-06 07:08:12 +0000 |
commit | 2561fc7e0261a98f3ed0752b0f0d81bce9cf6f52 (patch) | |
tree | b2bf95e9cccfdb9056549073ba377223530d114b /gcc | |
parent | 8211d82f8267a537ecf38139722f411ba37e09ae (diff) | |
download | gcc-2561fc7e0261a98f3ed0752b0f0d81bce9cf6f52.tar.gz |
(output_init_element): Call default_conversion here.
Set constructor_erroneous, etc., here.
(process_init_element): Not here.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@5086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-typeck.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index a08b72317e8..ec9d44e2ac7 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -5734,6 +5734,18 @@ output_init_element (value, type, field, pending) { int duplicate = 0; + if (TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE + || (TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE + && comptypes (TREE_TYPE (value), type))) + value = default_conversion (value); + + if (value == error_mark_node) + constructor_erroneous = 1; + else if (!TREE_CONSTANT (value)) + constructor_constant = 0; + else if (initializer_constant_valid_p (value, TREE_TYPE (value)) == 0) + constructor_simple = 0; + if (require_constant_value && ! TREE_CONSTANT (value)) { error_init ("initializer element%s is not constant", @@ -6026,18 +6038,6 @@ process_init_element (value) return; } - if (value != 0) - value = default_conversion (value); - - if (value == 0) - ; - else if (value == error_mark_node) - constructor_erroneous = 1; - else if (!TREE_CONSTANT (value)) - constructor_constant = 0; - else if (initializer_constant_valid_p (value, TREE_TYPE (value)) == 0) - constructor_simple = 0; - if (constructor_stack->replacement_value != 0) { error_init ("excess elements in struct initializer%s", |