gcc/testsuite/gdc.test/compilable/test22919.d
raw| 1 | // REQUIRED_ARGS: -checkaction=context -preview=dip1000 |
| 2 | |
| 3 | // Issue 22919 - [dip1000] -checkaction=context gives "assigned to `__assertOp2` with longer lifetime" ( |
| 4 | // https://issues.dlang.org/show_bug.cgi?id=22919 |
| 5 | |
| 6 | @safe: |
| 7 | struct S |
| 8 | { |
| 9 | int* p; |
| 10 | ref S get() scope return {return this;} |
| 11 | } |
| 12 | |
| 13 | void main() |
| 14 | { |
| 15 | scope S arr = S(); |
| 16 | assert(arr == arr.get()); |
| 17 | } |