[Issue 20040] New: dip1000 implicit delegate attribute stripping fails

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 10 19:31:43 UTC 2019


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 at puremagic.com
          Reporter: thomas.bockman at 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...

--


More information about the Digitalmars-d-bugs mailing list