diff options
| author | Wes Hardee <weshardee@gmail.com> | 2021-12-18 12:43:33 -0600 |
|---|---|---|
| committer | Wes Hardee <weshardee@gmail.com> | 2021-12-18 12:43:33 -0600 |
| commit | 92ce7defb12436b81eb1f2c19fa1e01be4a8ead3 (patch) | |
| tree | 75a9b9c9ad10d7a2b39b05afba2fd88a7a185f0f /src/check_stmt.cpp | |
| parent | a48317deee95b956430ace83f0db3e34bef590dd (diff) | |
| parent | 0548db423067bce16d45af651819bf56feb5d411 (diff) | |
Merge branch 'master' of https://github.com/weshardee/Odin
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 1a424240c..396388629 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -2243,6 +2243,9 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) { error(e->token, "The 'static' attribute is not allowed to be applied to '_'"); } else { e->flags |= EntityFlag_Static; + if (ctx->in_defer) { + error(e->token, "'static' variables cannot be declared within a defer statement"); + } } } if (ac.thread_local_model != "") { @@ -2251,9 +2254,13 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) { error(e->token, "The 'thread_local' attribute is not allowed to be applied to '_'"); } else { e->flags |= EntityFlag_Static; + if (ctx->in_defer) { + error(e->token, "'thread_local' variables cannot be declared within a defer statement"); + } } e->Variable.thread_local_model = ac.thread_local_model; } + if (ac.is_static && ac.thread_local_model != "") { error(e->token, "The 'static' attribute is not needed if 'thread_local' is applied"); |