``` @safe: struct S { int* p; ref S get() scope return {return this;} } unittest { int[3] sArr; scope S arr = S(); assert(arr == arr.get()); } ``` Compile with: > dmd -preview=dip1000 -checkaction=context test.d Gives: > scope variable `arr` assigned to `__assertOp2` with longer lifetime
Probably related to the numerous STC.temp hacks found in escape.d. `__assertOp2` is generated as an explicit temporary whose lifetime is restricted to the statement
@dkorpel created dlang/dmd pull request #13888 "Fix Issue 22919 - -checkaction=context gives "assigned to `__assertOp…" fixing this issue: - Fix Issue 22919 - -checkaction=context gives "assigned to `__assertOp2` with longer lifetime" https://github.com/dlang/dmd/pull/13888
dlang/dmd pull request #13888 "Fix Issue 22919 - -checkaction=context gives "assigned to `__assertOp…" was merged into master: - a791ebcb33b2033f73eec353886ddc25181e2b74 by Dennis Korpel: Fix Issue 22919 - -checkaction=context gives "assigned to `__assertOp2` with longer lifetime" https://github.com/dlang/dmd/pull/13888