I get testsuite failures with this change applied: FAIL: 20_util/shared_ptr/cons/43820_neg.cc (test for errors, line 858) FAIL: 20_util/shared_ptr/cons/43820_neg.cc (test for excess errors) FAIL: 20_util/weak_ptr/comparison/cmp_neg.cc (test for warnings, line 354) FAIL: 20_util/weak_ptr/comparison/cmp_neg.cc (test for warnings, line 1085) FAIL: 20_util/weak_ptr/comparison/cmp_neg.cc (test for excess errors)
Did you not see them when testing? Here's what I'm checking in 2012-01-03 Chase Douglas <chase.doug...@canonical.com> Jonathan Wakely <jwakely....@gmail.com> * include/bits/shared_ptr.h: Default copy ctor and assignment. * include/bits/shared_ptr_base.h: Likewise. * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust dg-error line numbers. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.
Index: include/bits/shared_ptr.h =================================================================== --- include/bits/shared_ptr.h (revision 182460) +++ include/bits/shared_ptr.h (working copy) @@ -100,6 +100,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr shared_ptr() : __shared_ptr<_Tp>() { } + shared_ptr(const shared_ptr&) = default; // never throws + /** * @brief Construct a %shared_ptr that owns the pointer @a __p. * @param __p A pointer that is convertible to element_type*. @@ -264,6 +266,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr shared_ptr(nullptr_t __p) : __shared_ptr<_Tp>(__p) { } + shared_ptr& operator=(const shared_ptr&) = default; + template<typename _Tp1> shared_ptr& operator=(const shared_ptr<_Tp1>& __r) // never throws Index: include/bits/shared_ptr_base.h =================================================================== --- include/bits/shared_ptr_base.h (revision 182460) +++ include/bits/shared_ptr_base.h (working copy) @@ -799,7 +799,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws { } - // generated copy constructor, assignment, destructor are fine. + __shared_ptr(const __shared_ptr&) = default; // never throws + __shared_ptr& operator=(const __shared_ptr&) = default; // never throws template<typename _Tp1, typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> Index: testsuite/20_util/shared_ptr/cons/43820_neg.cc =================================================================== --- testsuite/20_util/shared_ptr/cons/43820_neg.cc (revision 182460) +++ testsuite/20_util/shared_ptr/cons/43820_neg.cc (working copy) @@ -35,6 +35,6 @@ void test01() // { dg-error "incomplete" "" { target *-*-* } 766 } std::shared_ptr<X> p9(ap()); // { dg-error "here" } - // { dg-error "incomplete" "" { target *-*-* } 858 } + // { dg-error "incomplete" "" { target *-*-* } 859 } } Index: testsuite/20_util/weak_ptr/comparison/cmp_neg.cc =================================================================== --- testsuite/20_util/weak_ptr/comparison/cmp_neg.cc (revision 182460) +++ testsuite/20_util/weak_ptr/comparison/cmp_neg.cc (working copy) @@ -42,8 +42,8 @@ main() return 0; } -// { dg-warning "note" "" { target *-*-* } 354 } -// { dg-warning "note" "" { target *-*-* } 1085 } +// { dg-warning "note" "" { target *-*-* } 358 } +// { dg-warning "note" "" { target *-*-* } 1086 } // { dg-warning "note" "" { target *-*-* } 468 } // { dg-warning "note" "" { target *-*-* } 586 } // { dg-warning "note" "" { target *-*-* } 1049 }