The reason for not compiling safeD code on the gdc compiler

jfondren julian.fondren at gmail.com
Sat Aug 21 07:28:27 UTC 2021


On Saturday, 21 August 2021 at 07:16:46 UTC, Heikuw wrote:
> What causes this example of safeD code to be compiled in dmd 
> and ldc but not compiled in gcc?

The default behavior varies, but the dip1000 behavior is the same:

```
$ gdc -ftransition=dip1000 bug.d
bug.d:26:28: error: scope variable mp assigned to non-scope 
parameter p calling bug.f
    26 |     immutable(int)* ip = f(mp);
       |                            ^
$ dmd -preview=dip1000 bug.d
bug.d(26): Error: scope variable `mp` assigned to non-scope 
parameter `p` calling bug.f
$ ldc2 -preview=dip1000 bug.d
bug.d(26): Error: scope variable `mp` assigned to non-scope 
parameter `p` calling bug.f
```


More information about the D.gnu mailing list