zig
zig copied to clipboard
method call with optional struct reports compile error
Zig Version
0.11.0-dev.3+0bbb00035
Steps to Reproduce and Observed Behavior
const S = struct {
x: i32 = 1234,
fn method(s: ?S) void {
_ = s;
}
};
test {
var s: S = .{};
s.method();
}
$ stage3/bin/zig test test.zig
test.zig:11:6: error: no field or member function named 'method' in 'test.S'
s.method();
~^~~~~~~
test.zig:1:11: note: struct declared here
const S = struct {
^~~~~~
Expected Behavior
Test passed, like it does with -fstage1.