diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index d6987a332..617002281 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -2260,7 +2260,9 @@ gb_internal void check_value_decl_stmt(CheckerContext *ctx, Ast *node, u32 mod_f error(e->token, "'thread_local' variables cannot be declared within a defer statement"); } } - e->Variable.thread_local_model = ac.thread_local_model; + if (!build_context.no_thread_local) { + e->Variable.thread_local_model = ac.thread_local_model; + } } if (ac.is_static && ac.thread_local_model != "") {