aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-08-01 22:55:07 +0200
committerMichael Matz <matz@suse.de>2016-12-15 17:47:09 +0100
commitb7ca74577b56190954eb6eeda8c22996b877f3c5 (patch)
treeb613f1d6818e9b2fa89d632624228b3129111b8c /tccgen.c
parent9e86ebee944e7fc480fe49bf4f4f406aab672200 (diff)
downloadtinycc-b7ca74577b56190954eb6eeda8c22996b877f3c5.tar.gz
tinycc-b7ca74577b56190954eb6eeda8c22996b877f3c5.tar.bz2
struct-init: Allow member initialization from qualified lvalues
See testcase.
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c5
1 files changed, 4 insertions, 1 deletions
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;