From b7ca74577b56190954eb6eeda8c22996b877f3c5 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 1 Aug 2016 22:55:07 +0200 Subject: struct-init: Allow member initialization from qualified lvalues See testcase. --- tccgen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tccgen.c') diff --git a/tccgen.c b/tccgen.c index cb7e221..a833b17 100644 --- a/tccgen.c +++ b/tccgen.c @@ -6012,7 +6012,10 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, if (have_elem && !(type->t & VT_ARRAY) && - is_compatible_types(type, &vtop->type)) { + /* Use i_c_parameter_t, to strip toplevel qualifiers. + The source type might have VT_CONSTANT set, which is + of course assignable to a non-const elements. */ + is_compatible_parameter_types(type, &vtop->type)) { init_putv(type, sec, c); } else if (type->t & VT_ARRAY) { s = type->ref; -- cgit v1.3.1