| 1 |
/** |
| 2 |
REQUIRED_ARGS: -preview=dip1000 |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
fail_compilation/test23491.d(16): Error: reference to local variable `buffer` assigned to non-scope anonymous parameter is not allowed in a `@safe` function |
| 6 |
fail_compilation/test23491.d(17): Error: assigning reference to local variable `buffer` to non-scope anonymous parameter calling `sinkF` is not allowed in a `@safe` function |
| 7 |
fail_compilation/test23491.d(18): Error: assigning reference to local variable `buffer` to non-scope parameter `buf` is not allowed in a `@safe` function |
| 8 |
--- |
| 9 |
*/ |
| 10 |
|
| 11 |
void sinkF(char[]) @safe; |
| 12 |
|
| 13 |
void toString(void delegate (char[]) @safe sink, void delegate(char[] buf) @safe sinkNamed) @safe |
| 14 |
{ |
| 15 |
char[20] buffer = void; |
| 16 |
sink(buffer[]); |
| 17 |
sinkF(buffer[]); |
| 18 |
sinkNamed(buffer[]); |
| 19 |
} |