Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/test17284.d(17): Error: accessing overlapped field `U.c` with pointers is not allowed in a `@safe` function
5 pure nothrow @safe void(U t)
6 ---
7 REQUIRED_ARGS: -preview=bitfields
8 */
9
10 // https://issues.dlang.org/show_bug.cgi?id=17284
11
12 class C { }
13 union U { C c; int i; }
14
15 @safe void func(T)(T t)
16 {
17 t.c = new C;
18 }
19
20 pragma(msg, typeof(func!U));