[Issue 20040] dip1000 implicit delegate attribute stripping fails
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 19 08:07:44 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20040
Walter Bright <bugzilla at digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla at digitalmars.com
--- Comment #1 from Walter Bright <bugzilla at 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.
--
More information about the Digitalmars-d-bugs
mailing list