diff options
| author | gingerBill <bill@gingerbill.org> | 2023-01-16 12:03:46 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-01-16 12:03:46 +0000 |
| commit | b55fa268bf156ff72551868d84f45b579e2025b2 (patch) | |
| tree | 813f42faaa0835b8cbcb3397da24e95fc383b9ef /src/check_expr.cpp | |
| parent | c819c350d62b2069adc36407a35cb12bd7066a25 (diff) | |
Fix #2267 by making it an error
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 431b36664..6c3e731f8 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7323,8 +7323,10 @@ gb_internal void check_matrix_index_expr(CheckerContext *c, Operand *o, Ast *nod i64 column_index = 0; bool row_ok = check_index_value(c, t, false, ie->row_index, row_count, &row_index, nullptr); bool column_ok = check_index_value(c, t, false, ie->column_index, column_count, &column_index, nullptr); - - + if (is_const && (ie->row_index->tav.mode != Addressing_Constant || ie->column_index->tav.mode != Addressing_Constant)) { + error(o->expr, "Cannot index constant matrix with non-constant indices '%s'", expr_to_string(node)); + } + gb_unused(row_ok); gb_unused(column_ok); } |