[PATCH] D69810: [OpenCL] Fix address space for base method call (PR43145)

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 12:24:52 PST 2019


rjmccall added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:2721
+      From = ImpCastExprToType(From, DestASTy, CK_AddressSpaceConversion,
+                               From->getValueKind()).get();
+    }
----------------
Both the source and dest types here are off by a level if we're working with a pointer; you need to do:

```
  auto FromRecordTypeWithoutAS = Context.removeAddrSpaceQualType(FromRecordType);
  auto FromTypeWithDestAS = Context.getAddrSpaceQualType(FromRecordTypeWithoutAS, DestAS);
  if (PointerConversions)
   FromTypeWithDestAS = Context.getPointerType(FromTypeWithDestAS);
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69810/new/

https://reviews.llvm.org/D69810





More information about the cfe-commits mailing list