@@ -5689,8 +5689,10 @@ QualType Sema::CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS,
56895689 QualType LHSType = LHS.get ()->getType ();
56905690 QualType RHSType = RHS.get ()->getType ();
56915691
5692- bool LHSIsVector = LHSType->isVectorType () || LHSType->isSizelessVectorType ();
5693- bool RHSIsVector = RHSType->isVectorType () || RHSType->isSizelessVectorType ();
5692+ bool LHSSizelessVector = LHSType->isSizelessVectorType ();
5693+ bool RHSSizelessVector = RHSType->isSizelessVectorType ();
5694+ bool LHSIsVector = LHSType->isVectorType () || LHSSizelessVector;
5695+ bool RHSIsVector = RHSType->isVectorType () || RHSSizelessVector;
56945696
56955697 auto GetVectorInfo =
56965698 [&](QualType Type) -> std::pair<QualType, llvm::ElementCount> {
@@ -5708,7 +5710,7 @@ QualType Sema::CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS,
57085710 if (LHSIsVector && RHSIsVector) {
57095711 if (CondType->isExtVectorType () != LHSType->isExtVectorType ()) {
57105712 Diag (QuestionLoc, diag::err_conditional_vector_cond_result_mismatch)
5711- << /* isExtVector */ CondType-> isExtVectorType () ;
5713+ << /* isExtVectorNotSizeless= */ 1 ;
57125714 return {};
57135715 }
57145716
@@ -5720,7 +5722,13 @@ QualType Sema::CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS,
57205722 }
57215723 ResultType = Context.getCommonSugaredType (LHSType, RHSType);
57225724 } else if (LHSIsVector || RHSIsVector) {
5723- if (CondType->isSizelessVectorType ())
5725+ bool ResultSizeless = LHSSizelessVector || RHSSizelessVector;
5726+ if (ResultSizeless != CondType->isSizelessVectorType ()) {
5727+ Diag (QuestionLoc, diag::err_conditional_vector_cond_result_mismatch)
5728+ << /* isExtVectorNotSizeless=*/ 0 ;
5729+ return {};
5730+ }
5731+ if (ResultSizeless)
57245732 ResultType = CheckSizelessVectorOperands (LHS, RHS, QuestionLoc,
57255733 /* IsCompAssign*/ false ,
57265734 ArithConvKind::Conditional);
0 commit comments