diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-04-16 01:51:04 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-04-16 01:51:04 +0000 |
commit | a4fd0c9d612bde45184460088d8c2e20510a74b4 (patch) | |
tree | 018e372caaa8304a09fa624961c5bb4c695e3167 /test/support | |
parent | 98d9a858da5c08085eeec92f7edabd2555225ef2 (diff) |
Overhaul unique_ptr - Implement LWG 2801, 2905, 2520.
This patch overhauls both specializations of unique_ptr while implementing
the following LWG issues:
* LWG 2801 - This issue constrains unique_ptr's constructors when the deleter type
is not default constructible. Additionally it adds SFINAE conditions
to unique_ptr<T[]>::unique_ptr(Up).
* LWG 2905 - This issue reworks the unique_ptr(pointer, /* see below */ deleter)
constructors so that they correctly SFINAE when the deleter argument cannot
be used to construct the stored deleter.
* LWG 2520 - This issue fixes initializing unique_ptr<T[]> from nullptr.
Libc++ had previously implemented this issue, but the suggested resolution
still broke initialization from NULL. This patch re-works the
unique_ptr<T[]>(Up, deleter) overloads so that they accept NULL as well
as nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300406 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/deleter_types.h | 4 | ||||
-rw-r--r-- | test/support/test_workarounds.h | 8 |
2 files changed, 4 insertions, 8 deletions
diff --git a/test/support/deleter_types.h b/test/support/deleter_types.h index f7cdb624e..ec7016801 100644 --- a/test/support/deleter_types.h +++ b/test/support/deleter_types.h @@ -193,6 +193,10 @@ public: CDeleter() : state_(0) {} explicit CDeleter(int s) : state_(s) {} + template <class U> + CDeleter(const CDeleter<U>& d) + : state_(d.state()) {} + ~CDeleter() {assert(state_ >= 0); state_ = -1;} int state() const {return state_;} diff --git a/test/support/test_workarounds.h b/test/support/test_workarounds.h index 02982ba20..affdd1025 100644 --- a/test/support/test_workarounds.h +++ b/test/support/test_workarounds.h @@ -17,12 +17,4 @@ # define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR #endif -// FIXME(EricWF): Remove this. This macro guards tests for upcoming changes -// and fixes to unique_ptr. Until the changes have been implemented in trunk -// the tests have to be disabled. However the tests have been left in until -// then so they can be used by other standard libraries. -#if defined(_LIBCPP_VERSION) -# define TEST_WORKAROUND_UPCOMING_UNIQUE_PTR_CHANGES -#endif - #endif // SUPPORT_TEST_WORKAROUNDS_H |