D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19925 - static opDispatch not considered in WithStatement
Summary: static opDispatch not considered in WithStatement
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2019-05-31 08:40 UTC by Simen Kjaeraas
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Simen Kjaeraas 2019-05-31 08:40:57 UTC
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.
Comment 1 Dlang Bot 2019-06-20 19:23:48 UTC
@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
Comment 2 Dlang Bot 2019-06-21 00:41:06 UTC
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