[clang] [Clang] [Frontend] fix crash on parsing ternary operator with `vector_size` condition (PR #102004)

Pavel Skripkin via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 00:54:28 PDT 2024


================
@@ -6719,6 +6719,16 @@ QualType Sema::CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS,
             : UsualArithmeticConversions(LHS, RHS, QuestionLoc,
                                          ACK_Conditional);
 
+    if (ResultElementTy.isNull()) {
+      Diag(QuestionLoc, diag::err_conditional_vector_mismatched)
+          << LHSType << RHSType;
+      return {};
+    }
----------------
pskrgag wrote:

Yeah, it looks better, thanks! 

I am actually not sure if we support different types or not. `vector_size` is an extension and there is no clear wording what is allowed and what is not...  

https://github.com/llvm/llvm-project/pull/102004


More information about the cfe-commits mailing list