Should the `foo` function compile in the example code compile okay?
Ziggit
Should the `foo` function compile in the example code compile okay?
Now the foo function compiles okay, but should it? And should the baz function fail to compile instead? pub fn foo(_: anyerror!u8) void {} // compiles okay pub fn bar(x: anyerror!u8) void { _ = x; // error: error union is discarded } pub fn baz(x: anyerror!u8) void { _ = &x; // compiles okay } pub fn main() void { const v: anyerror!u8 = error.A; foo(v); bar(v); baz(v); }
0 comments
No comments yet.