summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-02-28 15:04:00 +1100
committerMaxime Coste <mawww@kakoune.org>2018-02-28 15:04:00 +1100
commitbebc81ebe1972eb33b89917bd520af2055d1fb6d (patch)
treef11ad64e6ab8a986272ab4a301b5a80d9fe96c01 /src
parent0d838f80a0cc920e64c6a5a969861f83d96967a6 (diff)
RefPtr: use inconditional noexcept specification on destructor
The conditional specification could end up being recursive, assume destructors must be (as is the C++ default) noexcept.
Diffstat (limited to 'src')
-rw-r--r--src/ref_ptr.hh7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/ref_ptr.hh b/src/ref_ptr.hh
index facd49b1..235ee2a3 100644
--- a/src/ref_ptr.hh
+++ b/src/ref_ptr.hh
@@ -22,7 +22,7 @@ struct RefCountable
struct RefCountablePolicy
{
static void inc_ref(RefCountable* r, void*) noexcept { ++r->refcount; }
- static void dec_ref(RefCountable* r, void*) noexcept(noexcept(r->~RefCountable())) { if (--r->refcount == 0) delete r; }
+ static void dec_ref(RefCountable* r, void*) noexcept { if (--r->refcount == 0) delete r; }
static void ptr_moved(RefCountable*, void*, void*) noexcept {}
};
@@ -31,7 +31,7 @@ struct RefPtr
{
RefPtr() = default;
explicit RefPtr(T* ptr) : m_ptr(ptr) { acquire(); }
- ~RefPtr() noexcept(noexcept(std::declval<RefPtr>().release())) { release(); }
+ ~RefPtr() noexcept { release(); }
RefPtr(const RefPtr& other) : m_ptr(other.m_ptr) { acquire(); }
RefPtr(RefPtr&& other)
noexcept(noexcept(std::declval<RefPtr>().moved(nullptr)))
@@ -102,8 +102,7 @@ private:
}
[[gnu::always_inline]]
- void release()
- noexcept(noexcept(Policy::dec_ref(nullptr, nullptr)))
+ void release() noexcept
{
if (m_ptr)
Policy::dec_ref(m_ptr, this);