[PATCH] D24472: [Sema] Support lax conversions for compound assignments

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 10:41:11 PDT 2016

ahatanak added inline comments.

Comment at: lib/Sema/SemaExpr.cpp:8084
@@ +8083,3 @@
+      *RHSExpr = ImpCastExprToType(RHSExpr->get(), LHSType, CK_BitCast);
+      return LHSType;
+    }
My understanding is that, when we have a compound assign like "LHS += RHS", this function (CheckVectorOperands) is supposed to return the result type (LHS + RHS). However, it is returning different types for "<1 x T> += T"  and "T += <1 x T>" (the former returns <1 x T> and the latter returns T). Would CheckAssignmentOperands reject the compound statement if you returned the vector type here?

Also, are you planning to allow the same kind of conversions done above for non-compound assignment statements (e.g., <4 x short> += <2 x int>) in the future?


More information about the cfe-commits mailing list