mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix so that rethrow is detected as well.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
13
test/test_suite/asm/naked_rethrow.c3
Normal file
13
test/test_suite/asm/naked_rethrow.c3
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user