aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/parse.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-13 13:00:37 +0200
committerlemon <lsof@mailbox.org>2022-08-13 13:00:37 +0200
commita4ddca68662f4bc0531763357b4bc00b6c50b456 (patch)
tree97f83407da049732ec97dd2d32ee34e0cd3c8c0f /bootstrap/parse.c
parent5b95abb249604e7df9be1d63b1f3dc85b8f5990b (diff)
target
Diffstat (limited to 'bootstrap/parse.c')
-rw-r--r--bootstrap/parse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bootstrap/parse.c b/bootstrap/parse.c
index 197b61b..7a35f09 100644
--- a/bootstrap/parse.c
+++ b/bootstrap/parse.c
@@ -1360,6 +1360,8 @@ pexpostfix(struct parser *P) {
const struct type *ty = ex.ty;
if (ty->t == TYptr)
ty = ty->child;
+ bool konst = ty->konst;
+ ty = unconstify(ty);
if (ty->t == TYstruct || ty->t == TYunion || ty->t == TYeunion) {
int idx = structfldnam2idx(ty, fnam);
struct aggfield *fld = &ty->agg.flds.d[idx];
@@ -1371,7 +1373,7 @@ pexpostfix(struct parser *P) {
ex.get.lhs = exprdup(ex);
ex.t = Eget;
ex.span = tok.span;
- ex.ty = ex.ty->konst ? constify(fld->ty) : fld->ty;
+ ex.ty = konst ? constify(fld->ty) : fld->ty;
ex.get.fld = fnam;
} else {
fatal(P, tok.span, "cannot access `%s': left-hand-side is not an aggregate (%t)",