summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/test17284.d
blob: 5bb3c2cc9f6dacf558c6141e41592236ae772e45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
TEST_OUTPUT:
---
fail_compilation/test17284.d(16): Error: field `U.c` cannot access pointers in `@safe` code that overlap other fields
pure nothrow @safe void(U t)
---
*/

// https://issues.dlang.org/show_bug.cgi?id=17284

class C { }
union U { C c; int i; }

@safe void func(T)(T t)
{
        t.c = new C;
}

pragma(msg, typeof(func!U));