@safe function with __gshared as default parameter value

data pulverizer data.pulverizer at gmail.com
Wed Apr 8 19:54:32 UTC 2020


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

Dude, you just broke `@safe`! Lol!


More information about the Digitalmars-d-learn mailing list