| 1 |
// https://issues.dlang.org/show_bug.cgi?id=20714 |
| 2 |
// REQUIRED_ARGS: -de |
| 3 |
/* |
| 4 |
TEST_OUTPUT: |
| 5 |
--- |
| 6 |
fail_compilation/fail20714.d(19): Deprecation: `struct Adder` implicitly-generated postblit hides copy constructor. |
| 7 |
fail_compilation/fail20714.d(19): The field postblit will have priority over the copy constructor. |
| 8 |
fail_compilation/fail20714.d(19): To change this, the postblit should be disabled for `struct Adder` |
| 9 |
--- |
| 10 |
*/ |
| 11 |
|
| 12 |
|
| 13 |
struct Blitter |
| 14 |
{ |
| 15 |
int payload; |
| 16 |
this(this){} |
| 17 |
} |
| 18 |
|
| 19 |
struct Adder |
| 20 |
{ |
| 21 |
Blitter blitter; |
| 22 |
this(int payload) {this.blitter.payload = payload;} |
| 23 |
this(ref Adder rhs) {this.blitter.payload = rhs.blitter.payload + 1;} |
| 24 |
} |
| 25 |
|
| 26 |
void main() |
| 27 |
{ |
| 28 |
Adder piece1 = 1; |
| 29 |
auto piece2 = piece1; |
| 30 |
|
| 31 |
assert(piece2.blitter.payload == 2); |
| 32 |
} |