dmd/compiler/test/fail_compilation/test17959.d
Dennis 9b94878c85
Make safe error messages consistent (#20654)
Co-authored-by: Dennis Korpel <dennis@sarc.nl>
2025-01-08 13:46:38 +08:00

21 lines
537 B
D

/* REQUIRED_ARGS: -preview=dip1000
TEST_OUTPUT:
---
fail_compilation/test17959.d(18): Error: assigning scope variable `this` to non-scope `this.escape` is not allowed in a `@safe` function
fail_compilation/test17959.d(19): Error: assigning scope variable `this` to non-scope `this.f` is not allowed in a `@safe` function
---
*/
// https://issues.dlang.org/show_bug.cgi?id=17959
class Foo
{
void delegate () @safe escape;
Foo f;
void escfoo() @safe scope
{
this.escape = &this.escfoo;
f = this;
}
}