diff options
Diffstat (limited to 'test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp')
-rw-r--r-- | test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp index 808284261f7d..90a9154e1840 100644 --- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp +++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp @@ -21,6 +21,7 @@ #include <cassert> #include "test_macros.h" +#include "incomplete_type_helper.h" template <class T> struct A @@ -52,12 +53,29 @@ struct B } }; + int main() { #if TEST_STD_VER >= 11 + { A<int> a; assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF))); + } + { + typedef IncompleteHolder* VT; + typedef A<VT> Alloc; + Alloc a; + assert(std::allocator_traits<Alloc >::allocate(a, 10, nullptr) == reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xDEADBEEF))); + } #endif + { B<int> b; assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xFEADBEEF))); + } + { + typedef IncompleteHolder* VT; + typedef B<VT> Alloc; + Alloc b; + assert(std::allocator_traits<Alloc >::allocate(b, 11, nullptr) == reinterpret_cast<VT*>(static_cast<std::uintptr_t>(0xFEADBEEF))); + } } |