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

22 lines
684 B
D

/* REQUIRED_ARGS: -preview=dip1000
TEST_OUTPUT:
---
fail_compilation/fail20691.d(106): Error: taking address of `scope` variable `sa` with pointers is not allowed in a `@safe` function
fail_compilation/fail20691.d(107): Error: taking address of `scope` variable `sa` with pointers is not allowed in a `@safe` function
fail_compilation/fail20691.d(108): Error: taking address of `scope` variable `sa` with pointers is not allowed in a `@safe` function
---
*/
#line 100
// https://issues.dlang.org/show_bug.cgi?id=20691
void bar() @safe
{
scope char[][2] sa;
scope char[][] da = cast(char[][])sa;
scope char[][] ca = sa;
foo(sa);
}
void foo(scope char[][] a) @safe;