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

ICE on comptime IIFE using both argument & return type inference #5834

Closed
bb010g opened this issue Jul 9, 2020 · 0 comments
Closed

ICE on comptime IIFE using both argument & return type inference #5834

bb010g opened this issue Jul 9, 2020 · 0 comments

Comments

@bb010g
Copy link

bb010g commented Jul 9, 2020

(Tested with Godbolt's Zig 0.6.0 & trunk builds.)

comptime {
    const hold_the_ice: bool = true;
    if (hold_the_ice) {
        @compileLog(struct { pub fn go() var { return "properly errors"; } }.go());
    } else {
        @compileLog("ICE ICE baby");
        @compileLog(struct { pub fn go(val: var) var { return val; } }.go("woah"));
        @compileLog("ICE melted");
    }
}

Output:

<source>:4:34: error: TODO implement inferred return types https://github.com/ziglang/zig/issues/447
        @compileLog(struct { pub fn go() var { return "properly errors"; } }.go());
                                 ^
<source>:4:77: note: referenced here
        @compileLog(struct { pub fn go() var { return "properly errors"; } }.go());
                                                                            ^
Compiler returned: 1

Output with const hold_the_ice: bool = false;:

| *"ICE ICE baby"
Compiler returned: 255

See also: #447.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant