This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Partial solution to LWG 523
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Tim Shen <timshen at google dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 6 Dec 2016 14:34:13 +0000
- Subject: Re: [PATCH] Partial solution to LWG 523
- Authentication-results: sourceware.org; auth=none
- References: <CAG4ZjNm2D+Kr30EEUy1L0vCec6JFW_ZT9cNLP5rj3Ej5yTOV+w@mail.gmail.com> <20161130130324.GQ3301@redhat.com> <20161130144526.GR3301@redhat.com>
On 30/11/16 14:45 +0000, Jonathan Wakely wrote:
On 30/11/16 13:03 +0000, Jonathan Wakely wrote:
On 26/11/16 16:27 -0800, Tim Shen wrote:
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 953aa87..2fb70b7 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -1000,7 +1000,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
element_type&
operator*() const noexcept
{
- __glibcxx_assert(_M_ptr != nullptr);
+ __glibcxx_assert(_M_get() != nullptr);
return *_M_get();
}
Oops, thanks, but let's fix this separately (I'll do it now) so the
rest of the patch only touches regex stuff.
I've fixed that with this patch, committed to trunk.
There's a similar problem in the __shared_ptr_access specialization
for shared_ptr<cv void>, fixed by this patch.
commit b69bee71a9eaa91f3a6fae875d702c9d39b02354
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Dec 6 14:13:54 2016 +0000
Fix debug mode assertion for std::shared_ptr<void>
* include/bits/shared_ptr_base.h
(__shared_ptr_access<T, L, false, true>::operator->()): Fix assertion.
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 2fb70b7..7e02043 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -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;
}
};