Index: include/type_traits =================================================================== --- include/type_traits +++ include/type_traits @@ -785,8 +785,16 @@ template struct __libcpp_is_pointer : public false_type {}; template struct __libcpp_is_pointer<_Tp*> : public true_type {}; +template struct __libcpp_remove_objc_qualifiers { typedef _Tp type; }; +#if defined(_LIBCPP_HAS_OBJC_ARC) +template struct __libcpp_remove_objc_qualifiers<_Tp __strong> { typedef _Tp type; }; +template struct __libcpp_remove_objc_qualifiers<_Tp __weak> { typedef _Tp type; }; +template struct __libcpp_remove_objc_qualifiers<_Tp __autoreleasing> { typedef _Tp type; }; +template struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretained> { typedef _Tp type; }; +#endif + template struct _LIBCPP_TEMPLATE_VIS is_pointer - : public __libcpp_is_pointer::type> {}; + : public __libcpp_is_pointer::type>::type> {}; #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) template Index: test/libcxx/type_traits/is_pointer.arc.pass.mm =================================================================== --- test/libcxx/type_traits/is_pointer.arc.pass.mm +++ test/libcxx/type_traits/is_pointer.arc.pass.mm @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: c++98, c++03 + +// + +// std::is_pointer + +// Test that we correctly handle Objective-C++ ARC qualifiers on pointers. + +#include + + +template +void test_is_pointer() { + static_assert(std::is_pointer::value, ""); + + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, ""); +} + +@class Foo; + +int main(int, char**) { + test_is_pointer(); + test_is_pointer(); + test_is_pointer(); + test_is_pointer(); + + test_is_pointer(); + test_is_pointer(); + test_is_pointer(); + test_is_pointer(); + + test_is_pointer(); + test_is_pointer(); + test_is_pointer(); + test_is_pointer(); + + return 0; +}