https://issues.dlang.org/show_bug.cgi?id=21286
Dennis <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Hardware|x86_64 |All OS|Linux |All --- Comment #4 from Dennis <[email protected]> --- I think the problem there is that it doesn't consider `getRef(p)` to be variable `p`. While the right hand side of an = uses `escapeByValue/escapeByRef` logic, the left hand side uses `expToVariable`, which can only return one variable, so it gives up on potential multiple-variable expressions. For example: ```D void main() @safe { int n; scope int* p; (n ? p : p) = &n; } ``` Error: reference to local variable `n` assigned to non-scope `*(n ? & p : & p)` I think this could be fixed by using the same escapeByValue logic for the lhs and repeating the rest of the checkAssignEscape logic for all possible lhs variables. It won't have the best time complexity, but complex lhs expressions should be rare. --
