Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/test17959.d

raw
1 /* REQUIRED_ARGS: -preview=dip1000
2 TEST_OUTPUT:
3 ---
4 fail_compilation/test17959.d(18): Error: assigning scope variable `this` to non-scope `this.escape` is not allowed in a `@safe` function
5 fail_compilation/test17959.d(19): Error: assigning scope variable `this` to non-scope `this.f` is not allowed in a `@safe` function
6 ---
7 */
8
9 // https://issues.dlang.org/show_bug.cgi?id=17959
10
11 class Foo
12 {
13 void delegate () @safe escape;
14 Foo f;
15
16 void escfoo() @safe scope
17 {
18 this.escape = &this.escfoo;
19 f = this;
20 }
21 }