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

** and ++ operators should generate operand expressions with comptime #1707

Closed
andrewrk opened this Issue Nov 7, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@andrewrk
Copy link
Member

andrewrk commented Nov 7, 2018

/home/andy/downloads/zig/build/test.zig:2:19: error: unable to evaluate constant expression
    var x = [1]Bar.{bar()} ** 10;
                  ^

But if we simply put comptime, it works:

    var x = comptime([1]Bar.{bar()}) ** 10; // OK

When we generate the expression for ** and for ++ they always require comptime operands. So it should implicitly generate comptime() around the operands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.