d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test13536.d
blobeff807ab5a341f06cbe2243b527227d1b9bee6bc
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/test13536.d(22): Error: field `U.sysDg` cannot access pointers in `@safe` code that overlap other fields
5 fail_compilation/test13536.d(23): Error: field `U.safeDg` cannot access pointers in `@safe` code that overlap other fields
6 ---
7 */
10 // https://issues.dlang.org/show_bug.cgi?id=13536
12 struct S {
13 void sysMethod() @system {}
15 void fun() @safe {
16 union U {
17 void delegate() @system sysDg;
18 void delegate() @safe safeDg;
20 U u;
21 S s;
22 u.sysDg = &s.sysMethod;
23 u.safeDg();