From: Marshall Clow Date: Mon, 17 Nov 2014 19:05:50 +0000 (+0000) Subject: Implement LWG2400 - 'shared_ptr's get_deleter() should use addressof()', and add... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=278ddec22c8b95d9849fb74450b7f9f18c80421c;p=platform%2Fupstream%2Fllvm.git Implement LWG2400 - 'shared_ptr's get_deleter() should use addressof()', and add tests. Mark LWG2400 and LWG2404 as complete llvm-svn: 222161 --- diff --git a/libcxx/include/memory b/libcxx/include/memory index b03ded9..662faa0 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -3660,7 +3660,7 @@ template const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT { - return __t == typeid(_Dp) ? &__data_.first().second() : 0; + return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : 0; } #endif // _LIBCPP_NO_RTTI diff --git a/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h b/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h index 7af7468..0263061 100644 --- a/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h +++ b/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h @@ -19,6 +19,12 @@ #include #include +#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#define DELETE_FUNCTION = delete +#else +#define DELETE_FUNCTION { assert(false); } +#endif + struct test_deleter_base { static int count; @@ -46,6 +52,8 @@ public: void set_state(int i) {state_ = i;} void operator()(T* p) {assert(state_ >= 0); ++dealloc_count; delete p;} + + test_deleter* operator&() const DELETE_FUNCTION; }; template diff --git a/libcxx/www/cxx1z_status.html b/libcxx/www/cxx1z_status.html index 1429de0..b6ddc10 100644 --- a/libcxx/www/cxx1z_status.html +++ b/libcxx/www/cxx1z_status.html @@ -76,9 +76,9 @@ 2377std::align requirements overly strictUrbana 2396underlying_type doesn't say what to do for an incomplete enumeration typeUrbana 2399shared_ptr 's constructor from unique_ptr should be constrainedUrbana - 2400shared_ptr 's get_deleter() should use addressof()Urbana + 2400shared_ptr 's get_deleter() should use addressof()UrbanaComplete 2401std::function needs more noexceptUrbana - 2404mismatch() 's complexity needs to be updatedUrbana + 2404mismatch() 's complexity needs to be updatedUrbanaComplete 2408SFINAE-friendly common_type / iterator_traits is missing in C++14Urbana