-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
unable to call var args function at compile time #313
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
Comments
andrewrk
added a commit
that referenced
this issue
Apr 7, 2017
How difficult is it to fix this? |
this is being fixed by #208, which removes zig var args in favor of anonymous lists. |
Here's what this looks like with tuples: const std = @import("std");
const assert = std.debug.assert;
test "runtime parameter before var args" {
comptime {
assert(extraFn(10, .{}) == 0);
assert(extraFn(10, .{false}) == 1);
assert(extraFn(10, .{ false, true }) == 2);
}
}
fn extraFn(extra: u32, args: var) usize {
if (args.len >= 1) {
assert(args[0] == false);
}
if (args.len >= 2) {
assert(args[1] == true);
}
return args.len;
}
var args removed from the language in a3f6a58 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: