dmd/compiler/test/fail_compilation/fail20084.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

19 lines
396 B
D

/* REQUIRED_ARGS: -preview=dip1000
TEST_OUTPUT:
---
fail_compilation/fail20084.d(109): Error: escaping a reference to parameter `v` by returning `v.front()` is not allowed in a `@safe` function
---
*/
#line 100
// https://issues.dlang.org/show_bug.cgi?id=20084
struct W() {
int value;
@safe ref int front() return { return value; }
}
@safe ref int get(W!() v) {
return v.front;
}