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 // allocator: 13 // pointer address(reference x) const; 14 // const_pointer address(const_reference x) const; 15 16 #include <memory> 17 #include <cassert> 18 19 template <class T> 20 void test_address() 21 { 22 T* tp = new T(); 23 const T* ctp = tp; 24 const std::allocator<T> a; 25 assert(a.address(*tp) == tp); 26 assert(a.address(*ctp) == tp); 27 delete tp; 28 } 29 30 struct A 31 { 32 void operator&() const {} 33 }; 34 35 int main() 36 { 37 test_address<int>(); 38 test_address<A>(); 39 } 40