diff --git a/src/Sema.zig b/src/Sema.zig index e9b6615f14cb614d30df0059e0ac8bafc6e1e312..f0a4e7f4c23b30e43c7ef3c1d705429785078615 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -28023,6 +28023,10 @@ fn fieldCallBind( if (concrete_ty.zigTypeTag(mod) == .ErrorUnion) { try sema.errNote(src, msg, "consider using 'try', 'catch', or 'if'", .{}); } + if (is_double_ptr) { + try sema.errNote(src, msg, "method invocation only supports up to one level of implicit pointer dereferencing", .{}); + try sema.errNote(src, msg, "use '.*' to dereference pointer", .{}); + } break :msg msg; }; return sema.failWithOwnedErrorMsg(block, msg); diff --git a/test/cases/compile_errors/call_from_double_ptr.zig b/test/cases/compile_errors/call_from_double_ptr.zig new file mode 100644 index 0000000000000000000000000000000000000000..51bb653a8aa386c24f8cf8f1305bc602f517e643 --- /dev/null +++ b/test/cases/compile_errors/call_from_double_ptr.zig @@ -0,0 +1,15 @@ +const S = struct { + fn b() void {} +}; + +export fn entry(a: **S) void { + _ = a.b(); +} + +// error +// backend=stage2 +// target=native +// +// 6:10: error: no field or member function named 'b' in '*tmp.S' +// 6:10: note: method invocation only supports up to one level of implicit pointer dereferencing +// 6:10: note: use '.*' to dereference pointer