Thread overview
[Issue 20040] dip1000 implicit delegate attribute stripping fails
Dec 19, 2019
Walter Bright
Feb 14, 2022
Walter Bright
Aug 11, 2022
Walter Bright
July 10, 2019
https://issues.dlang.org/show_bug.cgi?id=20040

thomas.bockman@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |regression

--
December 19, 2019
https://issues.dlang.org/show_bug.cgi?id=20040

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
The following will work:

  struct A {
    int* p;
    void method() scope pure @safe nothrow @nogc { }
  }

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

  void main() @safe {
    A a;
    test(&a.method);
  }

Note the two additions:

1. `scope` to method(), which says that the method won't escape `this.p` 2. `int* p;` because otherwise the `scope` added will be ignored

A possible fix to the compiler would be to have the address of a method be implicitly marked `scope` if none of the fields have any indirections.

--
February 14, 2022
https://issues.dlang.org/show_bug.cgi?id=20040

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe

--
August 11, 2022
https://issues.dlang.org/show_bug.cgi?id=20040

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
This is working in master.

--