diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 7e76d6ae6..5d7e536a9 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -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) { diff --git a/src/version.h b/src/version.h index 1fb56b042..e209179f9 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.3.83" \ No newline at end of file +#define COMPILER_VERSION "0.3.84" \ No newline at end of file diff --git a/test/test_suite/macros/macro_missing_return.c3 b/test/test_suite/macros/macro_missing_return.c3 new file mode 100644 index 000000000..af0f4e982 --- /dev/null +++ b/test/test_suite/macros/macro_missing_return.c3 @@ -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); +} \ No newline at end of file