Bug 19327 – case where a call to a static method is not allowed when located in a non static method

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-10-23T11:56:44Z
Last change time
2024-12-13T19:01:01Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
basile-z
See also
https://issues.dlang.org/show_bug.cgi?id=21886
Moved to GitHub: dmd#17883 →

Comments

Comment #0 by b2.temp — 2018-10-23T11:56:44Z
test case: ========== struct FiberS { static auto getThis(){ return Fiber.getId(); } } struct Proxy(T){ T* ptr; alias getPayload this; // works with "alias ptr this;" @property ref auto getPayload() inout return { return *ptr ; } static auto getId(){ return 1; } } alias Fiber = Proxy!(FiberS); struct TcpStream { static void test(){ auto id = Fiber.getThis(); // work here } void read(ubyte[] data){ auto id = Fiber.getThis(); // not work here } } forum discussion: ================= https://forum.dlang.org/post/[email protected]
Comment #1 by b2.temp — 2021-05-02T01:05:11Z
much simplified: --- struct T { static int target() {return 0;} } struct S { T t; T aliasGet(){return t;} alias aliasGet this; } struct Use { // S.aliasGet().target(): // ---------------------- // and T static members are tried static void ok() { auto v = S.target(); } // S.aliasGet(this).target(): // ---------------------- // T static members are not tried because error happens before void bug() { auto v = S.target(); } } ---
Comment #2 by robert.schadek — 2024-12-13T19:01:01Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17883 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB