aboutsummaryrefslogtreecommitdiff
path: root/test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp')
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp
new file mode 100644
index 0000000000000..04534f24d502e
--- /dev/null
+++ b/test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// pointer address(reference x) const;
+// const_pointer address(const_reference x) const;
+
+#include <memory>
+#include <cassert>
+
+template <class T>
+void test_address()
+{
+ T* tp = new T();
+ const T* ctp = tp;
+ const std::allocator<T> a;
+ assert(a.address(*tp) == tp);
+ assert(a.address(*ctp) == tp);
+ delete tp;
+}
+
+struct A
+{
+ void operator&() const {}
+};
+
+int main()
+{
+ test_address<int>();
+ test_address<A>();
+}