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

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 30 08:26:06 PDT 2016


yaxunl marked 6 inline comments as done.

================
Comment at: lib/AST/ASTContext.cpp:7613
@@ +7612,3 @@
+    if (getLangOpts().OpenCL) {
+      if (LHS.getUnqualifiedType() != RHS.getUnqualifiedType() ||
+          LQuals.getCVRQualifiers() != RQuals.getCVRQualifiers())
----------------
Anastasia wrote:
> > Here if unqualified types are different 
> 
> I think this check is redundant considering that we make check of canonical types equivalence in line 7605. Also it doesn't really have anything to do with any OpenCL specific rule. Therefore I would remove this check and just merge with lines 7623 - 7624 as much as possible.
> 
> > or CVS qualifiers are different, the two types cannot be merged
> 
> The same is already being checked in line 7623. Could we merge with that code?
> 
> 
The check for unqualified type is not redundant.

Let's say global int and generic float gets here. If we don't check unqualified type, we will get a non-null merged type, which is not correct.

It seems to be cleaner to keep the OpenCL logic separate from line 7623.


http://reviews.llvm.org/D17412





More information about the cfe-commits mailing list