diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2014-11-17 19:05:50 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2014-11-17 19:05:50 +0000 |
commit | 278ddec22c8b95d9849fb74450b7f9f18c80421c (patch) | |
tree | d2855d30aae168dc8a74a93208a541e0c461182a | |
parent | 6e0566c6d9a8e4d385e55af31072f192fa6826d4 (diff) | |
download | llvm-278ddec22c8b95d9849fb74450b7f9f18c80421c.zip llvm-278ddec22c8b95d9849fb74450b7f9f18c80421c.tar.gz llvm-278ddec22c8b95d9849fb74450b7f9f18c80421c.tar.bz2 |
Implement LWG2400 - 'shared_ptr's get_deleter() should use addressof()', and add tests. Mark LWG2400 and LWG2404 as complete
llvm-svn: 222161
-rw-r--r-- | libcxx/include/memory | 2 | ||||
-rw-r--r-- | libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h | 8 | ||||
-rw-r--r-- | libcxx/www/cxx1z_status.html | 4 |
3 files changed, 11 insertions, 3 deletions
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 <class _Tp, class _Dp, class _Alloc> 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 <type_traits> #include <cassert> +#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 <class T> 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 @@ <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2377">2377</a></td><td><code>std::align</code> requirements overly strict</td><td>Urbana</td><td></td></tr> <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2396">2396</a></td><td><code>underlying_type</code> doesn't say what to do for an incomplete enumeration type</td><td>Urbana</td><td></td></tr> <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2399">2399</a></td><td><code>shared_ptr</code> 's constructor from <code>unique_ptr</code> should be constrained</td><td>Urbana</td><td></td></tr> - <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2400">2400</a></td><td><code>shared_ptr</code> 's <code>get_deleter()</code> should use <code>addressof()</code></td><td>Urbana</td><td></td></tr> + <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2400">2400</a></td><td><code>shared_ptr</code> 's <code>get_deleter()</code> should use <code>addressof()</code></td><td>Urbana</td><td>Complete</td></tr> <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2401">2401</a></td><td><code>std::function</code> needs more noexcept</td><td>Urbana</td><td></td></tr> - <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2404">2404</a></td><td><code>mismatch()</code> 's complexity needs to be updated</td><td>Urbana</td><td></td></tr> + <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2404">2404</a></td><td><code>mismatch()</code> 's complexity needs to be updated</td><td>Urbana</td><td>Complete</td></tr> <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2408">2408</a></td><td>SFINAE-friendly <code>common_type</code> / <code>iterator_traits</code> is missing in C++14</td><td>Urbana</td><td></td></tr> <tr><td></td><td></td><td></td><td></td></tr> |