gcc/testsuite/gdc.test/fail_compilation/fail12764.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=12764 |
| 2 | |
| 3 | /* |
| 4 | TEST_OUTPUT: |
| 5 | --- |
| 6 | fail_compilation/fail12764.d(20): Error: field `s` must be initialized in constructor |
| 7 | --- |
| 8 | */ |
| 9 | |
| 10 | struct S |
| 11 | { |
| 12 | @disable this(); |
| 13 | |
| 14 | this(string) { } |
| 15 | int f; |
| 16 | } |
| 17 | |
| 18 | class C |
| 19 | { |
| 20 | this(int) |
| 21 | { |
| 22 | s.f = 1; // circumvents default ctor! |
| 23 | } |
| 24 | |
| 25 | S s; |
| 26 | } |