Index: libcxx/include/type_traits =================================================================== --- libcxx/include/type_traits +++ libcxx/include/type_traits @@ -65,6 +65,11 @@ template struct add_volatile; template struct add_cv; +#ifdef __clang__ + // Remove address space from type. + template struct __remove_address_space; +#endif + // Reference transformations: template struct remove_reference; template struct add_lvalue_reference; @@ -700,6 +705,14 @@ template using remove_cv_t = typename remove_cv<_Tp>::type; #endif +#ifdef __clang__ +// __remove_address_space + +template struct __remove_address_space; +template struct __remove_address_space<_Tp> { typedef _Tp type; }; +template struct __remove_address_space<_Tp __attribute__((address_space(I)))> { typedef _Tp __attribute__((address_space(I))) type; }; +#endif + // is_void template struct __libcpp_is_void : public false_type {}; Index: libcxx/test/libcxx/type_traits/address_space.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/libcxx/type_traits/address_space.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// + +#include +#ifdef __clang__ +typedef int __attribute__((address_space(2))) intAS2; + +void foo(){ + std::__remove_address_space i; + (void)i; +} +#endif + +int main(int, char**) { + return 0; +}