gcc/testsuite/gdc.test/fail_compilation/test22541.d
raw| 1 | /* REQUIRED_ARGS: -preview=dip1000 |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/test22541.d(104): Error: escaping a reference to parameter `i` by returning `i` is not allowed in a `@safe` function |
| 5 | fail_compilation/test22541.d(102): perhaps annotate the parameter with `return` |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | /* https://issues.dlang.org/show_bug.cgi?id=22541 |
| 10 | */ |
| 11 | |
| 12 | #line 100 |
| 13 | |
| 14 | @safe |
| 15 | ref int newe(ref return scope int i) // ref, error |
| 16 | { |
| 17 | return i; |
| 18 | } |