Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/test13536.d

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/test13536.d(22): Error: accessing overlapped field `U.sysDg` with pointers is not allowed in a `@safe` function
5 fail_compilation/test13536.d(23): Error: accessing overlapped field `U.safeDg` with pointers is not allowed in a `@safe` function
6 ---
7 */
8
9
10 // https://issues.dlang.org/show_bug.cgi?id=13536
11
12 struct S {
13 void sysMethod() @system {}
14 }
15 void fun() @safe {
16 union U {
17 void delegate() @system sysDg;
18 void delegate() @safe safeDg;
19 }
20 U u;
21 S s;
22 u.sysDg = &s.sysMethod;
23 u.safeDg();
24 }