[Issue 19327] New: case where a call to a static method is not allowed when located in a non static method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 23 11:56:44 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19327

          Issue ID: 19327
           Summary: case where a call to a static method is not allowed
                    when located in a non static method
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

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/tbuygtuzdfweirmlyzuw@forum.dlang.org

--


More information about the Digitalmars-d-bugs mailing list