forked from Mirrors/tinycc
pass constness from structs to members
parent
dca2b15df4
commit
e7297581fc
3
tccgen.c
3
tccgen.c
|
@ -3266,9 +3266,11 @@ static void unary(void)
|
||||||
inc(1, tok);
|
inc(1, tok);
|
||||||
next();
|
next();
|
||||||
} else if (tok == '.' || tok == TOK_ARROW) {
|
} else if (tok == '.' || tok == TOK_ARROW) {
|
||||||
|
int qualifiers;
|
||||||
/* field */
|
/* field */
|
||||||
if (tok == TOK_ARROW)
|
if (tok == TOK_ARROW)
|
||||||
indir();
|
indir();
|
||||||
|
qualifiers = vtop->type.t & (VT_CONSTANT | VT_VOLATILE);
|
||||||
test_lvalue();
|
test_lvalue();
|
||||||
gaddrof();
|
gaddrof();
|
||||||
next();
|
next();
|
||||||
|
@ -3290,6 +3292,7 @@ static void unary(void)
|
||||||
gen_op('+');
|
gen_op('+');
|
||||||
/* change type to field type, and set to lvalue */
|
/* change type to field type, and set to lvalue */
|
||||||
vtop->type = s->type;
|
vtop->type = s->type;
|
||||||
|
vtop->type.t |= qualifiers;
|
||||||
/* an array is never an lvalue */
|
/* an array is never an lvalue */
|
||||||
if (!(vtop->type.t & VT_ARRAY)) {
|
if (!(vtop->type.t & VT_ARRAY)) {
|
||||||
vtop->r |= lvalue_type(vtop->type.t);
|
vtop->r |= lvalue_type(vtop->type.t);
|
||||||
|
|
Loading…
Reference in New Issue