The below code does not compile, but should: unittest { with (S) { a(); // Compiles! b(); // Fails! } } struct S { static void a() {} static void opDispatch(string name)() {} } To make it worse, this compiles: unittest { with (S.init) { a(); // Compiles! b(); // Compiles! } } , showing that static methods are considered when looking up methods of an instance.
@Basile-z created dlang/dmd pull request #10068 "fix issue 19925 - static opDispatch not considered in WithStatement" fixing this issue: - fix issue 19925 - static opDispatch not considered in WithStatement https://github.com/dlang/dmd/pull/10068
dlang/dmd pull request #10068 "fix issue 19925 - static opDispatch not considered in WithStatement" was merged into master: - c02ec07697dacfeb3778fc13ad449b2e259934f2 by The Dlang Bot: fix issue 19925 - static opDispatch not considered in WithStatement https://github.com/dlang/dmd/pull/10068