We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
0.11.0-dev.3833+0a868dacd
fn takesAVector(vec: @Vector(1, f64)) void { _ = vec; } fn takesAnArray(arr: [1]f64) void { _ = arr; } pub fn main() void { var x: u64 = 0; var arr = [1]f64{@floatFromInt(x)}; // Works _ = arr; // _ = [1]f64{@floatFromInt(x)}; // Error // _ = takesAnArray([1]f64{@floatFromInt(x)}); // Error var vec = @Vector(1, f64){@floatFromInt(x)}; // Works _ = vec; // _ = @Vector(1, f64){@floatFromInt(x)}; // Error // _ = @Vector(1, f64){1} + @Vector(1, f64){@floatFromInt(x)}; // Error // _ = takesAVector(@Vector(1, f64){@floatFromInt(x)}); // Error }
Uncommenting any of the above leads to the following error:
$ zig run test.zig test.zig:5:17: error: @floatFromInt must have a known result type _ = [1]f64{@floatFromInt(x)}; // Error ^~~~~~~~~~~~~~~~
Given that the type is explicitly given in front of the initializer, the compiler should know what the field types are.
The text was updated successfully, but these errors were encountered:
Note that this is only an issue when the result is discarded (const y = [1]f64{@floatFromInt(x)} works fine).
const y = [1]f64{@floatFromInt(x)}
Sorry, something went wrong.
AstGen: fix result locations for elements of typed array init
10b3d15
Resolves: ziglang#16226
88284c1
Resolves: #16226
d4081b8
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
Zig Version
0.11.0-dev.3833+0a868dacd
Steps to Reproduce and Observed Behavior
Uncommenting any of the above leads to the following error:
Expected Behavior
Given that the type is explicitly given in front of the initializer, the compiler should know what the field types are.
The text was updated successfully, but these errors were encountered: