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 asserts unreachable when fn return type is 'var' #758

Closed
tgschultz opened this Issue Feb 8, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@tgschultz
Contributor

tgschultz commented Feb 8, 2018

const warn = @import("std").debug.warn;

fn func() var
{
    return i32(10);
}

test "return var" {
    var x = func();
    warn("{}\n", x);
}
@andrewrk

This comment has been minimized.

Member

andrewrk commented Feb 8, 2018

See #447

in the mean time a compile error would be friendlier than an assertion failure.

@andrewrk andrewrk added the bug label Feb 8, 2018

@andrewrk andrewrk added this to the 0.2.0 milestone Feb 8, 2018

@andrewrk andrewrk closed this in 6b5cfd9 Mar 7, 2018

@andrewrk

This comment has been minimized.

Member

andrewrk commented Mar 7, 2018

Now this example gives:

/home/andy/dev/zig/build/test.zig:3:1: error: TODO implement inferred return types https://github.com/zig-lang/zig/issues/447
fn func() var {
^

#447 is currently scheduled for 0.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment