aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2022-09-03 17:00:14 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2022-09-03 17:00:14 +0200
commit0ffffb12da7c38d55ead9e657c772c10a6266d51 (patch)
treea52b98411f5c370e3337bba6f0d7e6550051e48a /src/check_stmt.cpp
parent3f3f4fafff8c86dbf1022f5eb3b6885d1ee15e87 (diff)
parent4c857bf031be285e08ce64f0a89bbee5ee373d4b (diff)
Merge branch 'master' into sysinfo
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index d741ceabf..9e4504dc1 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1400,7 +1400,7 @@ bool check_expr_is_stack_variable(Ast *expr) {
expr = unparen_expr(expr);
Entity *e = entity_of_node(expr);
if (e && e->kind == Entity_Variable) {
- if (e->flags & (EntityFlag_Static|EntityFlag_Using)) {
+ if (e->flags & (EntityFlag_Static|EntityFlag_Using|EntityFlag_ImplicitReference|EntityFlag_ForValue)) {
// okay
} else if (e->Variable.thread_local_model.len != 0) {
// okay
@@ -1941,13 +1941,10 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
}
if (found == nullptr) {
entity = alloc_entity_variable(ctx->scope, token, type, EntityState_Resolved);
+ entity->flags |= EntityFlag_ForValue;
entity->flags |= EntityFlag_Value;
- if (i == addressable_index) {
- if (use_by_reference_for_value) {
- entity->flags &= ~EntityFlag_Value;
- } else {
- entity->flags |= EntityFlag_ForValue;
- }
+ if (i == addressable_index && use_by_reference_for_value) {
+ entity->flags &= ~EntityFlag_Value;
}
if (is_soa) {
if (i == 0) {