gcc/testsuite/gdc.test/fail_compilation/fail24208.d
raw| 1 | /+ |
| 2 | REQUIRED_ARGS: -preview=dip1000 |
| 3 | TEST_OUTPUT: |
| 4 | --- |
| 5 | fail_compilation/fail24208.d(19): Error: assigning reference to local variable `n` to non-scope parameter `p` calling `escape` is not allowed in a `@safe` function |
| 6 | fail_compilation/fail24208.d(15): which is not `scope` because of `escaped = p` |
| 7 | --- |
| 8 | +/ |
| 9 | void test() @safe |
| 10 | { |
| 11 | int* escaped; |
| 12 | |
| 13 | void escape(int* p) @safe |
| 14 | { |
| 15 | escaped = p; |
| 16 | } |
| 17 | |
| 18 | int n; |
| 19 | escape(&n); |
| 20 | } |