diff options
| author | gingerBill <bill@gingerbill.org> | 2024-04-01 13:16:49 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-04-01 13:16:49 +0100 |
| commit | 84686c70c56d95e6d42e0d15090f10f49c532695 (patch) | |
| tree | 5e7598165518a664eb36603d01eb67673323eb00 /src/check_stmt.cpp | |
| parent | 3fa02427b318e6e4e226de8b0435a47e01ceb415 (diff) | |
Error message when RTTI is disabled when iterating over an `enum` type or a `bit_set` of `enum` with `for in`
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 1df582e6c..883a6d213 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1525,6 +1525,9 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) array_add(&vals, operand.type); array_add(&vals, t_int); add_type_info_type(ctx, operand.type); + if (build_context.no_rtti) { + error(node, "Iteration over an enum type is not allowed runtime type information (RTTI) has been disallowed"); + } goto skip_expr_range_stmt; } } else if (operand.mode != Addressing_Invalid) { @@ -1561,6 +1564,9 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) is_bit_set = true; is_possibly_addressable = false; add_type_info_type(ctx, operand.type); + if (build_context.no_rtti && is_type_enum(t->BitSet.elem)) { + error(node, "Iteration over a bit_set of an enum is not allowed runtime type information (RTTI) has been disallowed"); + } break; case Type_EnumeratedArray: |