gcc/testsuite/gdc.dg/torture/gdc51.d
raw| 1 | // https://bugzilla.gdcproject.org/show_bug.cgi?id=51 |
| 2 | // { dg-do run } |
| 3 | // { dg-skip-if "needs gcc/config.d" { ! d_runtime } } |
| 4 | |
| 5 | struct S51 |
| 6 | { |
| 7 | int x; |
| 8 | int pad; |
| 9 | |
| 10 | this(this) |
| 11 | { |
| 12 | ++x; |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | void main() |
| 17 | { |
| 18 | S51 s; |
| 19 | auto sarr = new S51[1]; |
| 20 | auto sarr2 = sarr; |
| 21 | |
| 22 | // postblit all fields. |
| 23 | sarr2 ~= s; |
| 24 | |
| 25 | assert (sarr2[0].x == 1); |
| 26 | assert (sarr2[1].x == 1); |
| 27 | assert (sarr[0].x == 0); |
| 28 | assert (s.x == 0); |
| 29 | } |