mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix of bug where missing return wasn't detected.
This commit is contained in:
@@ -1748,7 +1748,7 @@ bool sema_expr_analyse_macro_call(SemaContext *context, Expr *call_expr, Expr *s
|
||||
params = macro_context.macro_params;
|
||||
bool is_no_return = decl->func_decl.signature.attrs.noreturn;
|
||||
|
||||
if (!vec_size(macro_context.returns))
|
||||
if (!vec_size(macro_context.returns) || !macro_context.active_scope.jump_end)
|
||||
{
|
||||
if (rtype && rtype != type_void)
|
||||
{
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.3.83"
|
||||
#define COMPILER_VERSION "0.3.84"
|
||||
12
test/test_suite/macros/macro_missing_return.c3
Normal file
12
test/test_suite/macros/macro_missing_return.c3
Normal file
@@ -0,0 +1,12 @@
|
||||
module test;
|
||||
import std::io;
|
||||
|
||||
macro int foo(int y) // #error: Missing return
|
||||
{
|
||||
if (y > 5) return y;
|
||||
}
|
||||
|
||||
fn void main()
|
||||
{
|
||||
int x = foo(3);
|
||||
}
|
||||
Reference in New Issue
Block a user