-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
concat (++) of anytype function parameter for runtime call #14817
Comments
Runtime fn f() *u32 {
var x: u32 = 42;
return &x;
} |
related: #3180 |
But why is it a runtime ++ when both parameters are comptime-known? |
Parameters are never comptime-known unless they are marked |
(they're also comptime-known if the function is marked Note that the reason the operands don't have to be comptime-known here is that their lengths are known by their types, since the type passed in is e.g. |
Zig Version
0.11.0-dev.1863+a63134a4a
Steps to Reproduce and Observed Behavior
Given the following code:
zig run concat.zig
produces:zig run -O ReleaseFast concat.zig
produces:Expected Behavior
I would either expect a compile error complaining about ++ being used at runtime, or I would expect ++ to force comptime evaluation, and give the following output:
EDIT: I think the best option is ++ forcing comptime evaluation, so it'll compile error with "can't resolve comptime value" or whatever for actual runtime values, and just work if the value is comptime-known.
The text was updated successfully, but these errors were encountered: