Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler does not halt when passing function to runtime anytype in recursive function #13486

Closed
silversquirl opened this issue Nov 8, 2022 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@silversquirl
Copy link
Contributor

silversquirl commented Nov 8, 2022

Zig Version

0.11.0-dev.86+b83e4d965

Steps to Reproduce and Observed Behavior

fn foo(f: anytype) void {
    f();
    foo(f);
}
fn bar() void {}

pub fn main() void {
    foo(bar);
}

Compiling with zig build-exe does not terminate

Expected Behavior

Compilation should either succeed (which it does for non-recursive code, or if comptime is added to the arg), or terminate with an error about function labels being comptime-only (which may be the actual correct behaviour)

@silversquirl silversquirl added the bug Observed behavior contradicts documented or intended behavior label Nov 8, 2022
@silversquirl
Copy link
Contributor Author

silversquirl commented Nov 8, 2022

Possibly related to #4572, though that's on stage1 and this is stage2

@Vexu
Copy link
Member

Vexu commented Nov 8, 2022

Duplicate of #13380

@Vexu Vexu marked this as a duplicate of #13380 Nov 8, 2022
@Vexu Vexu closed this as completed Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

2 participants