@safe function with __gshared as default parameter value

jmh530 john.michael.hall at gmail.com
Wed Apr 8 19:53:03 UTC 2020


On Wednesday, 8 April 2020 at 19:29:17 UTC, Anonymouse wrote:
> [snip]
>
> It works with `ref int` too.
>
>
> ```
> __gshared int gshared = 42;
>
> void foo(ref int i = gshared) @safe
> {
>     ++i;
> }
> void main()
> {
>     assert(gshared == 42);
>     foo();
>     assert(gshared == 43);
> }
> ```

Well that definitely shouldn't happen. I would file a bug report.


More information about the Digitalmars-d-learn mailing list