[PATCH] D49294: Sema: Fix explicit address space cast in C++

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 18 10:48:51 PDT 2018


rjmccall added inline comments.


================
Comment at: lib/Sema/SemaOverload.cpp:3150
+      !getLangOpts().OpenCLCPlusPlus)
+    return false;
+
----------------
yaxunl wrote:
> rjmccall wrote:
> > It's not really OpenCL C++ that's special here, it's the possibility of promotions between address spaces.
> For OpenCL C++, there is language rule about address space promotion.
> 
> For other languages, there is no generic rule about adderss space promotion, since the meaning of address space and their relations are target dependent. Do we want to introduce a target hook Target::canPromote(AddressSpace Src, AddressSpace Dest, LanguageOptions LangOpts) to represent this? Or do we just assume a simple rule, that is, all address space can be promoted to default address space 0, otherwise it is not allowed?
A target-specific hook for handling target-specific address spaces makes sense to me.  I don't think there's a generic rule allowing promotion into the default AS.


https://reviews.llvm.org/D49294





More information about the cfe-commits mailing list