| 1 |
// https://issues.dlang.org/show_bug.cgi?id=20068 |
| 2 |
|
| 3 |
union B |
| 4 |
{ |
| 5 |
int i; |
| 6 |
int* p; |
| 7 |
@safe this(int* p) |
| 8 |
{ |
| 9 |
// Error: cannot access pointers in @safe code that overlap other fields |
| 10 |
this.p = p; |
| 11 |
} |
| 12 |
} |
| 13 |
|
| 14 |
/**************************************************************/ |
| 15 |
// https://issues.dlang.org/show_bug.cgi?id=21229 |
| 16 |
|
| 17 |
struct NeedsInit |
| 18 |
{ |
| 19 |
int var; |
| 20 |
@disable this(); |
| 21 |
} |
| 22 |
|
| 23 |
union Union |
| 24 |
{ |
| 25 |
NeedsInit ni; |
| 26 |
} |
| 27 |
|
| 28 |
union Proxy |
| 29 |
{ |
| 30 |
Union union_; |
| 31 |
} |
| 32 |
|
| 33 |
struct S |
| 34 |
{ |
| 35 |
Union union_; |
| 36 |
Proxy proxy; |
| 37 |
|
| 38 |
this(NeedsInit arg) |
| 39 |
{ |
| 40 |
union_.ni = arg; |
| 41 |
proxy.union_.ni = arg; |
| 42 |
} |
| 43 |
} |