[clang] [Clang][Sema] Prevent implicit casting Complex type to Vector (PR #187954)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 3 05:19:42 PDT 2026


================
@@ -13069,6 +13073,11 @@ void Sema::CheckImplicitConversion(Expr *E, QualType T, SourceLocation CC,
       if (SourceMgr.isInSystemMacro(CC) || Target->isBooleanType())
         return;
 
+      if (!getLangOpts().CPlusPlus && T->isVectorType()) {
----------------
AmrDeveloper wrote:

> Also, instead of T, we should match what everything else does and use Target.

Because we strip the vector type before checking for ComplexTypes, at that point, `T` is VectorElementTy. The order is not problematic for other checks because they check that Target is a vector or a matrix, while checking for Vector or matrix before stripping it. I updated the order to perform checks for ComplexType first before stripping

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


More information about the cfe-commits mailing list