[clang] [clang][Sema] Allow splat initialization of a sizeless vector in a C++ code (PR #205432)

Paul Osmialowski via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 04:00:36 PDT 2026


================
@@ -8058,7 +8057,14 @@ bool Sema::CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
 }
 
 ExprResult Sema::prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr) {
-  QualType DestElemTy = VectorTy->castAs<VectorType>()->getElementType();
+  QualType DestElemTy =
+      VectorTy->isSizelessVectorType()
+          ? VectorTy->isSveVLSBuiltinType() || VectorTy->isRVVVLSBuiltinType()
+                ? Context
+                      .getBuiltinVectorTypeInfo(VectorTy->castAs<BuiltinType>())
+                      .ElementType
+                : VectorTy->getSizelessVectorEltType(Context)
+          : VectorTy->castAs<VectorType>()->getElementType();
----------------
pawosm-arm wrote:

Now I seriously think about disabling the entire feature for the bool type. The `getSizelessVectorEltType()` returns i8 for bool for a reason, maybe part of the reason is that such operations (like splat) should not be attempted on the bool-typed vectors?

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


More information about the cfe-commits mailing list