Fix debug mode assertion for std::shared_ptr<void>
authorJonathan Wakely <jwakely@redhat.com>
Tue, 6 Dec 2016 14:36:00 +0000 (14:36 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 6 Dec 2016 14:36:00 +0000 (14:36 +0000)
* include/bits/shared_ptr_base.h
(__shared_ptr_access<T, L, false, true>::operator->()): Fix assertion.

From-SVN: r243303

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/shared_ptr_base.h

index b8edb7b2412866dab3eb46302190a4d698fedd28..676d32b2722e68f93685ec5d17686373061943f5 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-06  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/bits/shared_ptr_base.h
+       (__shared_ptr_access<T, L, false, true>::operator->()): Fix assertion.
+
 2016-12-06  Ville Voutilainen  <ville.voutilainen@gmail.com>
 
        Constrain optional's __constexpr_addressof in its return type
index 2fb70b7a5cb670ee46280f8449b1af9252619975..7e02043ed12ff6fe1459e5f434692098b083eb98 100644 (file)
@@ -983,8 +983,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       element_type*
       operator->() const noexcept
       {
-       _GLIBCXX_DEBUG_PEDASSERT(_M_get() != nullptr);
-       return static_cast<const __shared_ptr<_Tp, _Lp>*>(this)->get();
+       auto __ptr = static_cast<const __shared_ptr<_Tp, _Lp>*>(this)->get();
+       _GLIBCXX_DEBUG_PEDASSERT(__ptr != nullptr);
+       return __ptr;
       }
     };