gcc/testsuite/gdc.test/fail_compilation/test17977.d
raw| 1 | /* |
| 2 | https://issues.dlang.org/show_bug.cgi?id=15399 |
| 3 | REQUIRED_ARGS: -preview=dip1000 |
| 4 | TEST_OUTPUT: |
| 5 | --- |
| 6 | fail_compilation/test17977.d(19): Error: assigning address of variable `__slList3` to `elem` with longer lifetime is not allowed in a `@safe` function |
| 7 | --- |
| 8 | */ |
| 9 | |
| 10 | @safe: |
| 11 | struct List { |
| 12 | int* data; |
| 13 | ~this(); |
| 14 | int* front() return; |
| 15 | } |
| 16 | |
| 17 | void test() |
| 18 | { |
| 19 | auto elem = List().front; |
| 20 | } |