Skip to content

Commit

Permalink
Sema: add error for recursive inline call
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexu committed Dec 26, 2022
1 parent 7feb59c commit 9568a20
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions compile_errors/recursive_inline_fn.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
inline fn foo(x: i32) i32 {
if (x <= 0) {
return 0;
} else {
return x * 2 + foo(x - 1);
}
}

pub export fn entry() void {
var x: i32 = 4;
_ = foo(x) == 20;
}

// error
// backend=stage2
// target=native
//
// :5:27: error: inline call is recursive

0 comments on commit 9568a20

Please sign in to comment.