[qfcc] Allow implicit demotion in initializer elements

Notably, implicit double constants (no adorning d) being used to
initialize float struct members.
This commit is contained in:
Bill Currie 2020-03-12 19:37:55 +09:00
parent 65b48c734c
commit 4c2a6c9eb2

View file

@ -380,6 +380,10 @@ init_elements (struct def_s *def, expr_t *eles)
&& is_float (element->type)) { && is_float (element->type)) {
convert_int (c); convert_int (c);
} }
if (is_double (get_type (c)) && is_float (element->type)
&& c->implicit) {
convert_double (c);
}
if (get_type (c) != element->type) { if (get_type (c) != element->type) {
error (c, "type mismatch in initializer"); error (c, "type mismatch in initializer");
continue; continue;