aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2014-12-13 00:44:17 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2014-12-13 00:44:17 +0000
commit93889749df8701ec3b77649898f38e2368555376 (patch)
tree6e853e3a82bd518f0a929a0c9235f432d6312de4
parent80d8f3796df2c61234ae2da976839d0e10df6015 (diff)
downloadgcc-93889749df8701ec3b77649898f38e2368555376.zip
gcc-93889749df8701ec3b77649898f38e2368555376.tar.gz
gcc-93889749df8701ec3b77649898f38e2368555376.tar.bz2
re PR libstdc++/58594 (std::make_shared does not accept const types as parameters)
PR libstdc++/58594 * include/bits/shared_ptr_base.h: Real fix for cv-qualified types. From-SVN: r218698
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/bits/shared_ptr_base.h9
2 files changed, 10 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a4ab4bf..9137a98 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-13 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/58594
+ * include/bits/shared_ptr_base.h: Real fix for cv-qualified types.
+
2014-12-12 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/64241
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 3ef783f..ad68c23 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -1106,7 +1106,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Alloc>
struct _Deleter
{
- void operator()(_Tp* __ptr)
+ void operator()(typename _Alloc::value_type* __ptr)
{
__allocated_ptr<_Alloc> __guard{ _M_alloc, __ptr };
allocator_traits<_Alloc>::destroy(_M_alloc, __guard.get());
@@ -1123,14 +1123,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
rebind_traits<typename std::remove_cv<_Tp>::type> __traits;
_Deleter<typename __traits::allocator_type> __del = { __a };
auto __guard = std::__allocate_guarded(__del._M_alloc);
- _M_ptr = __guard.get();
+ auto __ptr = __guard.get();
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2070. allocate_shared should use allocator_traits<A>::construct
- __traits::construct(__del._M_alloc, _M_ptr,
+ __traits::construct(__del._M_alloc, __ptr,
std::forward<_Args>(__args)...);
__guard = nullptr;
- __shared_count<_Lp> __count(_M_ptr, __del, __del._M_alloc);
+ __shared_count<_Lp> __count(__ptr, __del, __del._M_alloc);
_M_refcount._M_swap(__count);
+ _M_ptr = __ptr;
__enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr);
}
#endif