gcc/testsuite/gdc.test/fail_compilation/test22680.d
raw| 1 | /* REQUIRED_ARGS: -preview=dip1000 |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/test22680.d(104): Error: assigning scope variable `this` to global variable `c` is not allowed in a `@safe` function |
| 5 | --- |
| 6 | */ |
| 7 | |
| 8 | // https://issues.dlang.org/show_bug.cgi?id=22680 |
| 9 | |
| 10 | #line 100 |
| 11 | |
| 12 | C c; |
| 13 | class C { |
| 14 | ~this() @safe { |
| 15 | c = this; |
| 16 | } |
| 17 | } |