From e50a7faac600da70a5486a897460349160cec62e Mon Sep 17 00:00:00 2001 From: paolo Date: Sat, 6 Nov 2010 00:11:57 +0000 Subject: 2010-11-05 Paolo Carlini * include/bits/shared_ptr.h (shared_ptr<>::__shared_ptr(), shared_ptr<>::shared_ptr(nullptr_t), weak_ptr<>::weak_ptr(), enable_shared_from_this::enable_shared_from_this()): Add constexpr specifier. * include/bits/shared_ptr_base.h (__shared_count::__shared_count(), __shared_count::__shared_count(), __shared_ptr<>::__shared_ptr(), __shared_ptr<>::__shared_ptr(nullptr_t), __weak_ptr<>::__weak_ptr(), __enable_shared_from_this::__enable_shared_from_this()): Likewise. * include/bits/unique_ptr.h (default_delete, unique_ptr<>::unique_ptr(), unique_ptr<>::unique_ptr(nullptr_t)): Likewise. * testsuite/20_util/default_delete/cons/constexpr.cc: Do not xfail. * testsuite/20_util/shared_ptr/cons/constexpr.cc: Remove, the test cannot work for a non-literal type like std::shared_ptr. * testsuite/20_util/weak_ptr/cons/constexpr.cc: Likewise. * testsuite/util/testsuite_common_types.h: Add comments. * testsuite/20_util/unique_ptr/cons/constexpr.cc: Likewise. * testsuite/20_util/shared_ptr/cons/43820.cc: Adjust dg-error line numbers. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166386 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/include/bits/shared_ptr_base.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'libstdc++-v3/include/bits/shared_ptr_base.h') diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index 4a30ea4da6a..d39050fcc8d 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -443,7 +443,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) class __shared_count { public: - __shared_count() : _M_pi(0) // nothrow + constexpr __shared_count() : _M_pi(0) // nothrow { } template @@ -635,7 +635,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) class __weak_count { public: - __weak_count() : _M_pi(0) // nothrow + constexpr __weak_count() : _M_pi(0) // nothrow { } __weak_count(const __shared_count<_Lp>& __r) : _M_pi(__r._M_pi) // nothrow @@ -751,11 +751,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) public: typedef _Tp element_type; - __shared_ptr() : _M_ptr(0), _M_refcount() // never throws + constexpr __shared_ptr() + : _M_ptr(0), _M_refcount() // never throws { } template - explicit __shared_ptr(_Tp1* __p) : _M_ptr(__p), _M_refcount(__p) + explicit __shared_ptr(_Tp1* __p) + : _M_ptr(__p), _M_refcount(__p) { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) static_assert( sizeof(_Tp1) > 0, "incomplete type" ); @@ -856,7 +858,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) #endif /* TODO: use delegating constructor */ - __shared_ptr(nullptr_t) : _M_ptr(0), _M_refcount() // never throws + constexpr __shared_ptr(nullptr_t) + : _M_ptr(0), _M_refcount() // never throws { } template @@ -1163,7 +1166,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) public: typedef _Tp element_type; - __weak_ptr() : _M_ptr(0), _M_refcount() // never throws + constexpr __weak_ptr() + : _M_ptr(0), _M_refcount() // never throws { } // Generated copy constructor, assignment, destructor are fine. @@ -1324,7 +1328,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) class __enable_shared_from_this { protected: - __enable_shared_from_this() { } + constexpr __enable_shared_from_this() { } __enable_shared_from_this(const __enable_shared_from_this&) { } -- cgit v1.2.1