diff options
| author | gingerBill <bill@gingerbill.org> | 2025-01-05 13:19:10 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2025-01-05 13:19:10 +0000 |
| commit | 2efe4c2d68f486006e405ba7d30be03ec121ae6c (patch) | |
| tree | 5fdc5e6961c13026fe646ac6553b117bc4a0ae9b /src/check_expr.cpp | |
| parent | acbb14d87e136d771cbd70c12a14deb9cace48bd (diff) | |
Add `#+feature dynamic-literals`
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index fba9b8dad..fb3040e71 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -9730,8 +9730,11 @@ gb_internal ExprKind check_compound_literal(CheckerContext *c, Operand *o, Ast * if (t->kind == Type_DynamicArray) { - if (build_context.no_dynamic_literals && cl->elems.count) { + if (build_context.no_dynamic_literals && cl->elems.count && (node->file()->feature_flags & OptInFeatureFlag_DynamicLiterals) != 0) { + ERROR_BLOCK(); error(node, "Compound literals of dynamic types have been disabled"); + error_line("\tSuggestion: If you want to enable them for this specific file, use '#+feature dynamic-literals' at the top of the file\n"); + error_line("\tWarning: Please understand that dynamic literals will implicitly allocate using the current 'context.allocator' in that scope\n"); } } @@ -10120,8 +10123,11 @@ gb_internal ExprKind check_compound_literal(CheckerContext *c, Operand *o, Ast * } } - if (build_context.no_dynamic_literals && cl->elems.count) { + if (build_context.no_dynamic_literals && cl->elems.count && (node->file()->feature_flags & OptInFeatureFlag_DynamicLiterals) != 0) { + ERROR_BLOCK(); error(node, "Compound literals of dynamic types have been disabled"); + error_line("\tSuggestion: If you want to enable them for this specific file, use '#+feature dynamic-literals' at the top of the file\n"); + error_line("\tWarning: Please understand that dynamic literals will implicitly allocate using the current 'context.allocator' in that scope\n"); } else { add_map_reserve_dependencies(c); add_map_set_dependencies(c); |