aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 5e7e76d66..a43c296a6 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -613,6 +613,9 @@ gb_internal void check_struct_type(CheckerContext *ctx, Type *struct_type, Ast *
scope_reserve(ctx->scope, min_field_count);
+ rw_mutex_lock(&struct_type->Struct.fields_mutex);
+ defer (rw_mutex_unlock(&struct_type->Struct.fields_mutex));
+
if (st->is_raw_union && min_field_count > 1) {
struct_type->Struct.is_raw_union = true;
context = str_lit("struct #raw_union");