www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19327] New: case where a call to a static method is not

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 puremagic.com
          Reporter: b2.temp 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

--
Oct 23 2018