[libcxx-commits] [PATCH] D76636: [RFC] Added type trait to remove address space qualifier from type

John McCall via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 25 10:16:12 PDT 2020


rjmccall added a comment.

In D76636#1941575 <https://reviews.llvm.org/D76636#1941575>, @Anastasia wrote:

> In D76636#1940086 <https://reviews.llvm.org/D76636#1940086>, @rjmccall wrote:
>
> > Address spaces are actually defined in a number of standardized C extensions that are compatible with C++, such as the Embedded C specification, OpenCL, and so on.  There's precedent for libc++ accepting work that supports this kind of C++-compatible extension in the past; for example, `std::is_pointer` looks through Objective-C's ARC type qualifiers.  That said, (1) libc++ hasn't actually added new traits for such things before, just taught existing traits to handle them, and (2) I think this definition wouldn't actually work for cases like the OpenCL address spaces because they're not expressible as `__attribute__((address_space(N)))`.  (2) is fixable; (1) may be a reasonable place to draw the line on policy.
>
>
> Regarding (2) (although it's probably not changing the major concerns) this exact implementation also works for OpenCL because we map the address space keywords to the attributes during the parsing. However, OpenCL currently doesn't support libcxx. :(


Ah, okay.  Maybe it's one of the other languages that keeps its address spaces separate from `address_space`.

Regardless, if libc++ wants to have a policy of not adding new features that cover non-C++ features, that's a reasonable stance.  libc++ should consider whether `is_pointer` needs a workaround for stripping address-space qualifiers, though.


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

https://reviews.llvm.org/D76636





More information about the libcxx-commits mailing list