| author | |
| committer | |
| log | 9b292c094909e51718c1d37dbeb859674dd98c8a |
| tree | 82cc5238372e48270590e949eb2e7dfd17fe6e97 |
| parent | 93c546c8c9bf20b70b49546f278b4663b5c3f6d7 |
| signature |
2 files changed, 19 insertions(+), 0 deletions(-)
src/Sema.zig+4| ... | ... | @@ -28023,6 +28023,10 @@ fn fieldCallBind( |
| 28023 | 28023 | if (concrete_ty.zigTypeTag(mod) == .ErrorUnion) { |
| 28024 | 28024 | try sema.errNote(src, msg, "consider using 'try', 'catch', or 'if'", .{}); |
| 28025 | 28025 | } |
| 28026 | if (is_double_ptr) { | |
| 28027 | try sema.errNote(src, msg, "method invocation only supports up to one level of implicit pointer dereferencing", .{}); | |
| 28028 | try sema.errNote(src, msg, "use '.*' to dereference pointer", .{}); | |
| 28029 | } | |
| 28026 | 28030 | break :msg msg; |
| 28027 | 28031 | }; |
| 28028 | 28032 | return sema.failWithOwnedErrorMsg(block, msg); |
test/cases/compile_errors/call_from_double_ptr.zig created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | const S = struct { | |
| 2 | fn b() void {} | |
| 3 | }; | |
| 4 | ||
| 5 | export fn entry(a: **S) void { | |
| 6 | _ = a.b(); | |
| 7 | } | |
| 8 | ||
| 9 | // error | |
| 10 | // backend=stage2 | |
| 11 | // target=native | |
| 12 | // | |
| 13 | // 6:10: error: no field or member function named 'b' in '*tmp.S' | |
| 14 | // 6:10: note: method invocation only supports up to one level of implicit pointer dereferencing | |
| 15 | // 6:10: note: use '.*' to dereference pointer |