[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 09:04:28 PDT 2023


jhuber6 added a comment.

In D151087#4361081 <https://reviews.llvm.org/D151087#4361081>, @arsenm wrote:

> They bypass all semantic checks. For example if you declare something as address space 4, it will let you write to it unlike __constant__. It will let you place stack objects in globals and don't interact correctly with address space typed pointers in builtins (and any other context where you would want to interact with the matching language addrspace). Don't think sizeof works as you would expect either. Whatever is happening is not by design

I'm not sure how much work it would be to line up the numbers with the equivalent OpenCL type using the target info, or if that would break anything. However, I think this is out of scope, because even if we did have such semantic checks we'd still want to be able to `reinterpret_cast` on them in C++ which currently isn't allowed.


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