Debug help - opDispatch - unknown member function
Steven Schveighoffer
schveiguy at gmail.com
Tue Sep 9 19:17:11 UTC 2025
On Tuesday, 9 September 2025 at 00:40:31 UTC, Brother Bill wrote:
> ```
> c:\dev\D\D_templates_tutorial\toy1\source\app.d(8): Error: no
> property `callHome` for `l` of type `app.CallLogger!(C)`
> l.callHome("foo", "bar");
> ^
> ```
You might be expecting `opDispatch` inside `CallLogger` to try
and build `opDispatch!("callHome")("foo", "bar")`.
The thing is, it does. But when the compiler encounters failures,
it means that it assumes `opDispatch` was not designed to handle
that function, and it moves on to other options (UFCS maybe).
This is a long standing issue, and one that is very difficult to
fix due to the way name lookup rules are working in the compiler.
In short `opDispatch` only is valid if it compiles. If it doesn't
compile, it's as if it doesn't exist. This limitation is likely
with us until someone can rework how the name lookups and IFTI
works.
-Steve
More information about the Digitalmars-d-learn
mailing list