1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <memory> 10 11 // template <class T> 12 // struct pointer_traits<T*> 13 // { 14 // static pointer pointer_to(<details>); // constexpr in C++20 15 // ... 16 // }; 17 18 #include <memory> 19 #include <cassert> 20 #include "test_macros.h" 21 22 #if TEST_STD_VER > 17 23 constexpr 24 #endif check()25bool check() { 26 { 27 int i = 0; 28 static_assert((std::is_same<int *, decltype(std::pointer_traits<int*>::pointer_to(i))>::value), ""); 29 int* a = std::pointer_traits<int*>::pointer_to(i); 30 assert(a == &i); 31 } 32 { 33 (std::pointer_traits<void*>::element_type)0; 34 } 35 return true; 36 } 37 main(int,char **)38int main(int, char**) { 39 check(); 40 #if TEST_STD_VER > 17 41 static_assert(check(), ""); 42 #endif 43 44 return 0; 45 } 46