aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-07 06:43:30 +0200
committerlemon <lsof@mailbox.org>2022-08-07 06:43:30 +0200
commite26df7d77f923108ac121f1d6c9c3160a6855109 (patch)
tree43b66e9b4ce9c3a91229733b1db2ca36f2d7c7bf /bootstrap
parent27e22daa10040999f6e5bfe47aa2b8b504b40071 (diff)
constify access of const aggregate
Diffstat (limited to 'bootstrap')
-rw-r--r--bootstrap/parse.c2
-rw-r--r--bootstrap/test.cff3
2 files changed, 4 insertions, 1 deletions
diff --git a/bootstrap/parse.c b/bootstrap/parse.c
index b18c169..ace9e68 100644
--- a/bootstrap/parse.c
+++ b/bootstrap/parse.c
@@ -1125,7 +1125,7 @@ pexpostfix(struct parser *P) {
ex.get.lhs = exprdup(ex);
ex.t = Eget;
ex.span = tok.span;
- ex.ty = fld->ty;
+ ex.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)",
diff --git a/bootstrap/test.cff b/bootstrap/test.cff
index a000224..2a7a138 100644
--- a/bootstrap/test.cff
+++ b/bootstrap/test.cff
@@ -83,6 +83,9 @@ extern fn main (argc int, argv **u8) int {
printf("sl %d\n", slice[0]);
slice.#len;
+ let const v Vec2f = {};
+ ! v.x += 1;
+
printf("sizeof(is) = %zu\n", sizeof(is));
printf("sizeof *void = %zu\n", sizeof *void);
printf("1.2 -> %#.8x\n", transmute(u32, 1.2f));