gcc/testsuite/gdc.dg/torture/pr123422.d
raw| 1 | // { dg-do run } |
| 2 | // { dg-skip-if "needs gcc/config.d" { ! d_runtime } } |
| 3 | struct S123422 |
| 4 | { |
| 5 | S123422* ptr; |
| 6 | this(int) { ptr = &this; } |
| 7 | this(ref inout S123422) { ptr = &this; } |
| 8 | } |
| 9 | |
| 10 | struct V123422 |
| 11 | { |
| 12 | S123422 s; |
| 13 | this(int) { s = S123422(1); } |
| 14 | } |
| 15 | |
| 16 | S123422 foo() |
| 17 | { |
| 18 | return V123422(1).s; |
| 19 | } |
| 20 | |
| 21 | void main() |
| 22 | { |
| 23 | S123422 s = foo(); |
| 24 | assert(&s == s.ptr); |
| 25 | } |