1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <memory> 11 12 // template <class T> 13 // struct pointer_traits<T*> 14 // { 15 // static pointer pointer_to(<details>); // constexpr in C++20 16 // ... 17 // }; 18 19 #include <memory> 20 #include <cassert> 21 #include "test_macros.h" 22 23 #if TEST_STD_VER > 17 24 constexpr 25 #endif 26 bool check() { 27 { 28 int i = 0; 29 static_assert((std::is_same<int *, decltype(std::pointer_traits<int*>::pointer_to(i))>::value), ""); 30 int* a = std::pointer_traits<int*>::pointer_to(i); 31 assert(a == &i); 32 } 33 { 34 (std::pointer_traits<void*>::element_type)0; 35 } 36 return true; 37 } 38 39 int main() { 40 check(); 41 #if TEST_STD_VER > 17 42 static_assert(check(), ""); 43 #endif 44 } 45