Index: include/memory =================================================================== --- include/memory +++ include/memory @@ -43,7 +43,7 @@ template using rebind = U*; - static pointer pointer_to(
) noexcept; + static pointer pointer_to(
) noexcept; // constexpr in C++20 }; template constexpr T* to_address(T* p) noexcept; // C++20 @@ -984,7 +984,7 @@ private: struct __nat {}; public: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 static pointer pointer_to(typename conditional::value, __nat, element_type>::type& __r) _NOEXCEPT {return _VSTD::addressof(__r);} Index: test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp =================================================================== --- test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp +++ test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp @@ -12,15 +12,18 @@ // template // struct pointer_traits // { -// static pointer pointer_to(
); +// static pointer pointer_to(
); // constexpr in C++20 // ... // }; #include #include +#include "test_macros.h" -int main() -{ +#if TEST_STD_VER > 17 +constexpr +#endif +bool check() { { int i = 0; static_assert((std::is_same::pointer_to(i))>::value), ""); @@ -30,4 +33,12 @@ { (std::pointer_traits::element_type)0; } + return true; +} + +int main() { + check(); +#if TEST_STD_VER > 17 + static_assert(check(), ""); +#endif }