-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Odd error when using BoundedArray
at comptime, but not runtime due to @memcpy
#15633
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
Unrelated to the bug, but Reduction: const S = struct {
buffer: [8]u8 = undefined,
fn set(self: *S, items: []const u8) void {
@memcpy(self.buffer[0..items.len], items);
}
};
comptime {
var s = S{};
s.set("hello");
} |
Duplicate of #15634 |
Sorry, not a duplicate, didn't notice the slice. |
Vexu
added a commit
to Vexu/zig
that referenced
this issue
May 14, 2023
Vexu
added a commit
to Vexu/zig
that referenced
this issue
May 14, 2023
Vexu
added a commit
to Vexu/zig
that referenced
this issue
May 14, 2023
Vexu
added a commit
to Vexu/zig
that referenced
this issue
May 14, 2023
Vexu
added a commit
to Vexu/zig
that referenced
this issue
May 15, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Zig Version
0.11.0-dev.3031+f40539e5d
Steps to Reproduce and Observed Behavior
run the following
tmp.zig
which produces the following error:
but moving the
comptime
block inside ofmain
is fine:Expected Behavior
The code at compile time to produce the correct value without erroring
The text was updated successfully, but these errors were encountered: