www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20040] New: dip1000 implicit delegate attribute stripping fails

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

          Issue ID: 20040
           Summary: dip1000 implicit delegate attribute stripping fails
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: thomas.bockman gmail.com

struct A {
        void method() pure  safe nothrow  nogc { }
}

void test(scope void delegate() del)  safe { }

void main()  safe {
    A a;

    // OK:
    void delegate() del = &a.method;

/*
onlineapp.d(19): Error: function onlineapp.test(scope void delegate() del) is
        not callable using argument types (void delegate() pure nothrow  nogc
 safe)
onlineapp.d(19):        cannot pass argument &a.method of type void delegate()
        pure nothrow  nogc  safe to parameter scope void delegate() del
*/
    test(&a.method); 
}

The above code works fine - as, I believe, it should - unless I compile with
-preview=dip1000 . This issue breaks some of my toString() implementations, so
a fix would be appreciated...

--
Jul 10 2019