dip1000 + pure is a DEADLY COMBO

Per Nordlöw per.nordlow at gmail.com
Fri May 14 09:15:18 UTC 2021


On Wednesday, 12 May 2021 at 13:14:30 UTC, Dennis wrote:
> The root cause is:
> [Issue 20150 - -dip1000 defeated by 
> pure](https://issues.dlang.org/show_bug.cgi?id=20150)

Moreover, the code example

```d
int* escape(int* r) @safe pure
{
     return r;
}

int* f() @safe
{
     int x = 42;
     return escape(&x); /* Should not compile. */
}
```

referenced at [1] correctly fails to compile with dmd master 
using `-dip1000` as

     main.d(9,20): Error: cannot take address of local `x` in 
`@safe` function `f`

Again, I fail to see the problem here.

[1] https://issues.dlang.org/show_bug.cgi?id=20150


More information about the Digitalmars-d mailing list