================ @@ -11647,6 +11647,29 @@ static void DiagnoseFloatingImpCast(Sema &S, Expr *E, QualType T, } } +static void CheckCommaOperand(Sema &S, Expr *E, QualType T, SourceLocation CC, + bool Check) { + E = E->IgnoreParenImpCasts(); + AnalyzeImplicitConversions(S, E, CC); + + if (Check && E->getType() != T) + S.CheckImplicitConversion(E, T, CC); +} + +/// Analyze the given comma operator. The basic idea behind the analysis is to +/// analyze the left and right operands slightly differently. The left operand +/// needs to check whether the operand itself has an implicit conversion, but +/// not whether the left operand induces an implicit conversion for the entire +/// comma expression itself. This is similar to how CheckConditionalOperand +/// behaves; it's as-if the correct operand were directly used for the implicit +/// conversion check. +static void AnalyzeCommaOperator(Sema &S, BinaryOperator *E, QualType T) { + assert(E->isCommaOp() && "Must be a comma operator"); + + CheckCommaOperand(S, E->getLHS(), T, E->getOperatorLoc(), false); ---------------- erichkeane wrote:
I don't think the out-of-line function is worth the effort here, the fact that 50% of it changes based on the bool, says to me that we probably need to just inline it. https://github.com/llvm/llvm-project/pull/138752 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits