Skip to content

@call() error when used in inline for #6341

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

Closed
LiterallyVoid opened this issue Sep 14, 2020 · 1 comment
Closed

@call() error when used in inline for #6341

LiterallyVoid opened this issue Sep 14, 2020 · 1 comment

Comments

@LiterallyVoid
Copy link
Contributor

Code:

const std = @import("std");

test "" {
    const T = struct {
        fn func() void {}
    };
    inline for (.{ 0, 1 }) |val| {
        @call(.{}, T.func, .{});
    }
}

Error:

./zigtest.zig:8:16: error: cannot assign to constant
        @call(.{}, T.func, .{});
               ^
./zigtest.zig:3:9: note: referenced here
test "" {
        ^
./zigtest.zig:8:16: error: cannot assign to constant
        @call(.{}, T.func, .{});
               ^

Error does not occur if only run once (i.e. inline for (.{ 0 }) ...

@LiterallyVoid
Copy link
Contributor Author

Just realized this is duplicate of #4639

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