@@ -401,6 +401,17 @@ bool ByteCodeExprGen<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) {
401401 const Expr *LHS = BO->getLHS ();
402402 const Expr *RHS = BO->getRHS ();
403403
404+ // Handle comma operators. Just discard the LHS
405+ // and delegate to RHS.
406+ if (BO->isCommaOp ()) {
407+ if (!this ->discard (LHS))
408+ return false ;
409+ if (RHS->getType ()->isVoidType ())
410+ return this ->discard (RHS);
411+
412+ return this ->delegate (RHS);
413+ }
414+
404415 if (BO->getType ()->isAnyComplexType ())
405416 return this ->VisitComplexBinOp (BO);
406417 if ((LHS->getType ()->isAnyComplexType () ||
@@ -416,16 +427,6 @@ bool ByteCodeExprGen<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) {
416427 std::optional<PrimType> RT = classify (RHS->getType ());
417428 std::optional<PrimType> T = classify (BO->getType ());
418429
419- // Deal with operations which have composite or void types.
420- if (BO->isCommaOp ()) {
421- if (!this ->discard (LHS))
422- return false ;
423- if (RHS->getType ()->isVoidType ())
424- return this ->discard (RHS);
425-
426- return this ->delegate (RHS);
427- }
428-
429430 // Special case for C++'s three-way/spaceship operator <=>, which
430431 // returns a std::{strong,weak,partial}_ordering (which is a class, so doesn't
431432 // have a PrimType).
0 commit comments