------ struct S { void sysMethod() @system {} } void fun() @safe { union U { void delegate() @system sysDg; void delegate() @safe safeDg; } U u; S s; u.sysDg = &s.sysMethod; // s.sysMethod(); // the compiler catches this u.safeDg(); // but not this } ------
https://github.com/dlang/dmd/pull/5859
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/8e480a56f514284d919e894c103288dda67ea243 fix Issue 13536 - Union of delegates breaks @safety https://github.com/dlang/dmd/commit/82fa43ff6cdea746aa626af1f8bc1ac52b228e90 Merge pull request #5859 from WalterBright/fix13536 fix Issue 13536 - Union of delegates breaks @safety
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/8e480a56f514284d919e894c103288dda67ea243 fix Issue 13536 - Union of delegates breaks @safety https://github.com/dlang/dmd/commit/82fa43ff6cdea746aa626af1f8bc1ac52b228e90 Merge pull request #5859 from WalterBright/fix13536