+2016-10-10 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/shared_ptr.h (enable_shared_from_this::weak_from_this):
+ Add noexcept.
+ * include/bits/shared_ptr_base.h
+ (__enable_shared_from_this::weak_from_this): Likewise.
+ * testsuite/20_util/enable_shared_from_this/members/weak_from_this.cc:
+ Test exception-specification of weak_from_this.
+
2016-10-07 Jonathan Wakely <jwakely@redhat.com>
* doc/xml/manual/status_cxx1998.xml: Improve documentation of
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
#define __cpp_lib_enable_shared_from_this 201603
weak_ptr<_Tp>
- weak_from_this()
+ weak_from_this() noexcept
{ return this->_M_weak_this; }
weak_ptr<const _Tp>
- weak_from_this() const
+ weak_from_this() const noexcept
{ return this->_M_weak_this; }
#endif
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
__weak_ptr<_Tp, _Lp>
- weak_from_this()
+ weak_from_this() noexcept
{ return this->_M_weak_this; }
__weak_ptr<const _Tp, _Lp>
- weak_from_this() const
+ weak_from_this() const noexcept
{ return this->_M_weak_this; }
#endif
struct X : public std::enable_shared_from_this<X> { };
+static_assert( noexcept(std::declval<X&>().weak_from_this()) );
+static_assert( noexcept(std::declval<const X&>().weak_from_this()) );
+
void
test01()
{