================
@@ -1484,8 +1484,32 @@ void InitListChecker::CheckListElementTypes(const 
InitializedEntity &Entity,
   } else if (DeclType->isOCLIntelSubgroupAVCType() ||
              DeclType->isSizelessBuiltinType()) {
     // Checks for scalar type are sufficient for these types too.
-    CheckScalarType(Entity, IList, DeclType, Index, StructuredList,
-                    StructuredIndex);
+    Expr *expr =
+        (Index < IList->getNumInits()) ? IList->getInit(Index) : nullptr;
+    // Prevent splat when doing list initialization.
+    if (expr && expr->getType()->isArithmeticType() &&
+        DeclType->isSizelessVectorType()) {
+      if (!VerifyOnly) {
+        if (SemaRef.Context.getLangOpts().CPlusPlus) {
+          PartialDiagnostic PDiag =
+              SemaRef.PDiag(diag::err_init_conversion_failed)
+              << (int)Entity.getKind() << DeclType << expr->isLValue()
----------------
pawosm-arm wrote:

changed to `static_cast<int>`

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

Reply via email to