[PATCH] D17412: PR19957: [OpenCL] incorrectly accepts implicit address space conversion with ternary operator

Xiuli PAN via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 9 20:03:11 PST 2016


pxli168 added a comment.

The logic is still to complex and I hope it can be optimized.


================
Comment at: lib/Sema/SemaExpr.cpp:6222-6227
@@ -6188,1 +6221,8 @@
+    auto ResultAddrSpace = ResultTy.getQualifiers().getAddressSpace();
+    LHSCastKind = lhQual.getAddressSpace() == ResultAddrSpace
+                      ? CK_BitCast
+                      : CK_AddressSpaceConversion;
+    RHSCastKind = rhQual.getAddressSpace() == ResultAddrSpace
+                      ? CK_BitCast
+                      : CK_AddressSpaceConversion;
     ResultTy = S.Context.getPointerType(ResultTy);
----------------
What will mergetypes return?
It seems the LHS and RHS are compatibel here, and may be they did not need bitcast?


Repository:
  rL LLVM

http://reviews.llvm.org/D17412





More information about the cfe-commits mailing list