[Issue 22309] Taking the address of a stack variable struct with this is wrongly seen as @safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 28 12:53:11 UTC 2022


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

Dennis <dkorpel at live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dkorpel at live.nl
           Hardware|x86_64                      |All
         Resolution|---                         |FIXED
                 OS|Linux                       |All

--- Comment #2 from Dennis <dkorpel at live.nl> ---
As mentioned in the Pull Request discussion, this has to be covered by dip1000.
As of https://github.com/dlang/dmd/pull/13672, the code is rejected with
-preview=dip1000:
```
test_.d(4): Error: reference to local variable `this` assigned to non-scope
parameter `foo` calling test_.Bar.this
test_.d(21): Error: reference to local variable `foo` assigned to non-scope
parameter `foo` calling test_.Bar.this
```

--


More information about the Digitalmars-d-bugs mailing list