diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-10-27 20:25:16 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-10-27 20:35:30 -0400 |
| commit | 63a5032ca06cd9f9bfaea6b0ea077d49a3034654 (patch) | |
| tree | e925fa942bbb3a9d61aedbbfcf92ca5f2f96d7f1 /typecheck.c | |
| parent | 052316261a94f2846e7547b65b2bb089979ce5ba (diff) | |
Disallow mutation of read-only views
Diffstat (limited to 'typecheck.c')
| -rw-r--r-- | typecheck.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/typecheck.c b/typecheck.c index ceefda19..6cc41216 100644 --- a/typecheck.c +++ b/typecheck.c @@ -1293,7 +1293,7 @@ PUREFUNC bool can_be_mutated(env_t *env, ast_t *ast) auto index = Match(ast, Index); type_t *indexed_type = get_type(env, index->indexed); if (indexed_type->tag == PointerType) - return true; + return !Match(indexed_type, PointerType)->is_view; return can_be_mutated(env, index->indexed); } default: return false; |
