aboutsummaryrefslogtreecommitdiff
path: root/semantics.c
diff options
context:
space:
mode:
Diffstat (limited to 'semantics.c')
-rw-r--r--semantics.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/semantics.c b/semantics.c
index 3d12162..930a3cf 100644
--- a/semantics.c
+++ b/semantics.c
@@ -1064,7 +1064,15 @@ ExpType exp_check_postfix(CNode *p, CScope_t scope) {
t2 = op2.type->type;
if (!IS_INT(t2))
ERROR((p, "array subscript is not an integer"));
- op1.type = op1.type->rec.arr.elem;
+ if (t1 == CARR)
+ {
+ op1.type = op1.type->rec.arr.elem;
+ p->ext.is_const = p->chd->ext.is_const;
+ }
+ else
+ {
+ op1.type = op1.type->rec.ref;
+ }
op1.lval = 1;
break;
case POSTFIX_CALL: