diff --git a/src/analyze.cpp b/src/analyze.cpp index 29866ffa3..b43d7dfe3 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -498,7 +498,7 @@ static void resolve_function_proto(CodeGen *g, AstNode *node, FnTableEntry *fn_t // next, loop over the parameters again and compute debug information // and codegen information - bool first_arg_return = handle_is_ptr(return_type); + bool first_arg_return = !fn_proto->skip && handle_is_ptr(return_type); // +1 for maybe making the first argument the return value LLVMTypeRef *gen_param_types = allocate(1 + src_param_count); // +1 because 0 is the return type and +1 for maybe making first arg ret val diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 39c6e6c8e..4fd262e88 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1254,6 +1254,29 @@ pub fn main(args: [][]u8) %void => { stdout.printf("BAD\n"); } stdout.printf("OK\n"); +} + )SOURCE", "OK\n"); + + add_simple_case("%% binary operator", R"SOURCE( +import "std.zig"; +error ItBroke; +fn g(x: bool) %isize => { + if (x) { + error.ItBroke + } else { + 10 + } +} +pub fn main(args: [][]u8) %void => { + const a = g(true) %% 3; + const b = g(false) %% 3; + if (a != 3) { + stdout.printf("BAD\n"); + } + if (b != 10) { + stdout.printf("BAD\n"); + } + stdout.printf("OK\n"); } )SOURCE", "OK\n"); }