diff options
author | Eric Fiselier <eric@efcs.ca> | 2015-06-14 23:30:09 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2015-06-14 23:30:09 +0000 |
commit | b11df184ad642c8601d4073fff54974fd76b70c7 (patch) | |
tree | 2f8021a139db2aaafbcb564043a66556ba0505a0 /libcxx/test/support | |
parent | 9a03362a08941620e3fb4f583b4c85bc6b4dd6e5 (diff) | |
download | bcm5719-llvm-b11df184ad642c8601d4073fff54974fd76b70c7.tar.gz bcm5719-llvm-b11df184ad642c8601d4073fff54974fd76b70c7.zip |
Fix std::function allocator constructors in C++03.
The C++03 version of function tried to default construct the allocator
in the uses allocator constructors when no allocation was performed. These
constructors would fail to compile when used with allocators that had no
default constructor.
llvm-svn: 239708
Diffstat (limited to 'libcxx/test/support')
-rw-r--r-- | libcxx/test/support/test_allocator.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libcxx/test/support/test_allocator.h b/libcxx/test/support/test_allocator.h index 03bd3905606..47ef1d55678 100644 --- a/libcxx/test/support/test_allocator.h +++ b/libcxx/test/support/test_allocator.h @@ -74,10 +74,10 @@ public: } ++time_to_throw; ++alloc_count; - return (pointer)std::malloc(n * sizeof(T)); + return (pointer)::operator new(n * sizeof(T)); } void deallocate(pointer p, size_type n) - {assert(data_ >= 0); --alloc_count; std::free(p);} + {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);} size_type max_size() const throw() {return UINT_MAX / sizeof(T);} void construct(pointer p, const T& val) @@ -134,10 +134,10 @@ public: } ++time_to_throw; ++alloc_count; - return (pointer)std::malloc(n * sizeof(T)); + return (pointer)::operator new (n * sizeof(T)); } void deallocate(pointer p, size_type n) - {assert(data_ >= 0); --alloc_count; std::free(p);} + {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); } size_type max_size() const throw() {return UINT_MAX / sizeof(T);} void construct(pointer p, const T& val) @@ -200,9 +200,9 @@ public: template <class U> other_allocator(const other_allocator<U>& a) : data_(a.data_) {} T* allocate(std::size_t n) - {return (T*)std::malloc(n * sizeof(T));} + {return (T*)::operator new(n * sizeof(T));} void deallocate(T* p, std::size_t n) - {std::free(p);} + {::operator delete((void*)p);} other_allocator select_on_container_copy_construction() const {return other_allocator(-2);} |