aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorSam Watkins <sam@nikas.(none)>2009-06-16 04:26:44 +0800
committerSam Watkins <sam@nikas.(none)>2009-06-16 04:26:44 +0800
commite7297581fcebbd5242e8349fa9537c4ccb1a9eba (patch)
tree4718757c4ec5943855d121d5ca7c9e9dbf20d81b /tccgen.c
parentdca2b15df42c1341794dd412917708416da25594 (diff)
downloadtinycc-e7297581fcebbd5242e8349fa9537c4ccb1a9eba.tar.gz
tinycc-e7297581fcebbd5242e8349fa9537c4ccb1a9eba.tar.bz2
pass constness from structs to members
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 942c503..fcfaa7e 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -3266,9 +3266,11 @@ static void unary(void)
inc(1, tok);
next();
} else if (tok == '.' || tok == TOK_ARROW) {
+ int qualifiers;
/* field */
if (tok == TOK_ARROW)
indir();
+ qualifiers = vtop->type.t & (VT_CONSTANT | VT_VOLATILE);
test_lvalue();
gaddrof();
next();
@@ -3290,6 +3292,7 @@ static void unary(void)
gen_op('+');
/* change type to field type, and set to lvalue */
vtop->type = s->type;
+ vtop->type.t |= qualifiers;
/* an array is never an lvalue */
if (!(vtop->type.t & VT_ARRAY)) {
vtop->r |= lvalue_type(vtop->type.t);