diff options
author | Teddy <[email protected]> | 2014-04-16 16:19:08 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2014-04-16 16:19:08 +0800 |
commit | 27205d8a475e3a8ddafacd4426635187735a35f5 (patch) | |
tree | 4aafbf27df806a313af88de4afa0a7fb8abf0e3b /semantics.c | |
parent | e9babbcd0c0d91d89774fc72d091bb42420221c3 (diff) |
prepare for test
Diffstat (limited to 'semantics.c')
-rw-r--r-- | semantics.c | 10 |
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: |