1 /*
2 PERMUTE_ARGS:
3 TEST_OUTPUT:
4 ---
5 fail_compilation/test13536.d(24): Error: field U.sysDg cannot access pointers in @safe code that overlap other fields
6 fail_compilation/test13536.d(24): Error: address of variable `s` assigned to `u` with longer lifetime
7 fail_compilation/test13536.d(25): Error: field U.safeDg cannot access pointers in @safe code that overlap other fields
8 ---
9 */
10 
11 
12 // https://issues.dlang.org/show_bug.cgi?id=13536
13 
14 struct S {
sysMethodS15     void sysMethod() @system {}
16 }
fun()17 void fun() @safe {
18     union U {
19         void delegate() @system sysDg;
20         void delegate() @safe safeDg;
21     }
22     U u;
23     S s;
24     u.sysDg = &s.sysMethod;
25     u.safeDg();
26 }
27 
28