Fix so that rethrow is detected as well.

This commit is contained in:
Christoffer Lerno
2025-07-29 20:50:32 +02:00
parent 3ac9bfc387
commit 8151305701
2 changed files with 17 additions and 0 deletions

View File

@@ -9197,6 +9197,10 @@ static inline bool sema_expr_analyse_rethrow(SemaContext *context, Expr *expr, T
context->call_env.current_function->name,
type_quoted_error_string(context->rtype));
}
if (context->call_env.is_naked_fn)
{
RETURN_SEMA_ERROR(expr, "Rethrow is not allowed in a '@naked' function.");
}
}
return true;
}

View File

@@ -0,0 +1,13 @@
import std;
fn void main()
{
(void)test();
}
fn ulong? test() @naked @noinline
{
int? z;
z!; // #error: Rethrow is not allowed in a '@naked' function
unreachable();
}