pow: Ensure side effects are evaluated in e1^^0 rewrite

This commit is contained in:
Iain Buclaw 2025-03-29 18:55:30 +01:00 committed by The Dlang Bot
parent 95fdc47f5f
commit 5c9c91a651
2 changed files with 22 additions and 3 deletions

View file

@ -12818,11 +12818,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
result = ex;
return;
}
// Replace e1 ^^ 0 with 1
// Replace e1 ^^ 0 with (e1, 1)
else if (expo == 0)
{
Expression ex = one;
ex.loc = exp.loc;
Expression ex = new CommaExp(exp.loc, pe.e1, one, exp);
ex = ex.expressionSemantic(sc);
result = ex;
return;