https://issues.dlang.org/show_bug.cgi?id=21590
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] | |rg Hardware|x86_64 |All OS|Linux |All --- Comment #1 from [email protected] --- That's an unintended consequence of the current rewrite for expressions with side effects. The compiler lowers the example to: unittest { int a = 0; int b = 1; (ref int __assertOp2 = a = b;) , assert(__assertOp2, _d_assert_fail(__assertOp2)); } The assignment happens for the temporary and hence becomes legal. The compiler should probably check if the expression can be used as a condition before the rewrite. --
