[Issue 24574] Scope not inferred on this parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 30 13:50:42 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24574
Dennis <dkorpel at live.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |safe
CC| |dkorpel at live.nl
Hardware|x86_64 |All
OS|Linux |All
--- Comment #1 from Dennis <dkorpel at live.nl> ---
I think both calls should fail to compile, because they can escape through
self-assignment:
```D
struct A
{
A* p;
@safe nothrow pure void f()
{
this.p.p = p;
}
}
@trusted nothrow pure void g(ref A a)
{
a.p.p = a.p;
}
@safe void e(ref scope A a)
{
a.f(); // (1)
g(a); // (2)
}
```
--
More information about the Digitalmars-d-bugs
mailing list