| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/ice10259.d(11): Error: circular reference to `ice10259.D.d` |
| 5 |
fail_compilation/ice10259.d(11): called from here: `(*function () pure nothrow @safe => x)()` |
| 6 |
--- |
| 7 |
*/ |
| 8 |
class D |
| 9 |
{ |
| 10 |
int x; |
| 11 |
D d = { auto x = new D(); return x; }(); |
| 12 |
} |
| 13 |
enum x = new D; |
| 14 |
|
| 15 |
/* |
| 16 |
TEST_OUTPUT: |
| 17 |
--- |
| 18 |
fail_compilation/ice10259.d(25): Error: circular reference to `ice10259.D2.d` |
| 19 |
fail_compilation/ice10259.d(25): called from here: `(*function () pure nothrow @safe => x)()` |
| 20 |
--- |
| 21 |
*/ |
| 22 |
class D2 |
| 23 |
{ |
| 24 |
int x; |
| 25 |
D2 d = function { auto x = new D2(); return x; }(); |
| 26 |
} |
| 27 |
enum x2 = new D2; |