[PATCH] D151087: [Clang] Permit address space casts with 'reinterpret_cast' in C++

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 22 07:57:33 PDT 2023


jhuber6 added a comment.

In D151087#4360818 <https://reviews.llvm.org/D151087#4360818>, @ebevhan wrote:

> By "freestanding C++" I assume you mean "C++ without the OpenCL C++ extension" and not "C++ without extensions at all", because in the latter case, you don't have address spaces either.
>
> This is what I meant in D58346 <https://reviews.llvm.org/D58346> by "There's many places in the codebase where OpenCL flags restrict generic address space behavior." Isn't the solution here to allow addrspace_cast even when OpenCL C++ isn't turned on, as a more generic extension?

You can have address spaced in freestanding C++, they just need to be assigned according to the backend, e.g. https://godbolt.org/z/ahazae6Ta. And I don't think that's a desirable solution because it would require a language extension to cover a use-case that isn't disallowed by the C++ standard anyway. I don't see a reason why we shouldn't be able to do this directly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151087



More information about the cfe-commits mailing list