================
@@ -8112,6 +8112,13 @@ ExprResult Sema::BuildVectorLiteral(SourceLocation 
LParenLoc,
     // it will be replicated to all components of the vector.
     if (getLangOpts().OpenCL && VTy->getVectorKind() == VectorKind::Generic &&
         numExprs == 1) {
+      QualType SrcTy = exprs[0]->getType();
+      if (!SrcTy->isArithmeticType()) {
+        Diag(exprs[0]->getBeginLoc(), diag::err_typecheck_convert_incompatible)
+            << Ty << SrcTy << AssignmentAction::Initializing << /*elidable=*/0
+            << /*c_style=*/0 << /*cast_kind=*/"" << exprs[0]->getSourceRange();
+        return ExprError();
+      }
----------------
wenju-he wrote:

> (int4)((short4)x)

This will be diagnosed earlier at 
https://github.com/llvm/llvm-project/blob/2a2a394215b38631588d504d2b671df13370395b/clang/lib/Sema/SemaExpr.cpp#L7927

https://github.com/llvm/llvm-project/pull/180318
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to