* include/bits/shared_ptr.h (shared_ptr<>::shared_ptr(_Tp1*, _Deleter,
const _Alloc&), shared_ptr(nullptr_t, _Deleter, const _Alloc&)): Take
the allocator by value, per N3225.
(shared_ptr<>::shared_ptr(_Sp_make_shared_tag, _Alloc, _Args&&...),
allocate_shared(_Alloc, _Args&&...): Viceversa, take the allocator
by const lvalue ref.
* include/bits/shared_ptr_base.h (__shared_count<>::
__shared_count(_Sp_make_shared_tag, _Tp*, _Alloc, _Args&&...),
__shared_ptr<>::__shared_ptr(_Sp_make_shared_tag, _Alloc, _Args&&...),
__allocate_shared(_Alloc, _Args&&...)): Likewise.
(__shared_ptr<>::__shared_ptr(_Tp1*, _Deleter, const _Alloc&),
__shared_ptr(nullptr_t, _Deleter, const _Alloc&), reset(_Tp1*,
_Deleter, const _Alloc&)): Take the allocator by value.
* 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@167510
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-12-06 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/shared_ptr.h (shared_ptr<>::shared_ptr(_Tp1*, _Deleter,
+ const _Alloc&), shared_ptr(nullptr_t, _Deleter, const _Alloc&)): Take
+ the allocator by value, per N3225.
+ (shared_ptr<>::shared_ptr(_Sp_make_shared_tag, _Alloc, _Args&&...),
+ allocate_shared(_Alloc, _Args&&...): Viceversa, take the allocator
+ by const lvalue ref.
+ * include/bits/shared_ptr_base.h (__shared_count<>::
+ __shared_count(_Sp_make_shared_tag, _Tp*, _Alloc, _Args&&...),
+ __shared_ptr<>::__shared_ptr(_Sp_make_shared_tag, _Alloc, _Args&&...),
+ __allocate_shared(_Alloc, _Args&&...)): Likewise.
+ (__shared_ptr<>::__shared_ptr(_Tp1*, _Deleter, const _Alloc&),
+ __shared_ptr(nullptr_t, _Deleter, const _Alloc&), reset(_Tp1*,
+ _Deleter, const _Alloc&)): Take the allocator by value.
+ * testsuite/20_util/shared_ptr/cons/43820.cc: Adjust dg-error line
+ numbers.
+ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.
+
2010-12-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* acinclude.m4 (symvers_renaming): Also set if enable_symvers = no.
* __shared_ptr will release __p by calling __d(__p)
*/
template<typename _Tp1, typename _Deleter>
- shared_ptr(_Tp1* __p, _Deleter __d) : __shared_ptr<_Tp>(__p, __d) { }
+ shared_ptr(_Tp1* __p, _Deleter __d)
+ : __shared_ptr<_Tp>(__p, __d) { }
/**
* @brief Construct a %shared_ptr that owns a null pointer
* __shared_ptr will release __p by calling __d(__p)
*/
template<typename _Tp1, typename _Deleter, typename _Alloc>
- shared_ptr(_Tp1* __p, _Deleter __d, const _Alloc& __a)
- : __shared_ptr<_Tp>(__p, __d, __a) { }
+ shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a)
+ : __shared_ptr<_Tp>(__p, __d, std::move(__a)) { }
/**
* @brief Construct a %shared_ptr that owns a null pointer
* The last owner will call __d(__p)
*/
template<typename _Deleter, typename _Alloc>
- shared_ptr(nullptr_t __p, _Deleter __d, const _Alloc& __a)
- : __shared_ptr<_Tp>(__p, __d, __a) { }
+ shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a)
+ : __shared_ptr<_Tp>(__p, __d, std::move(__a)) { }
// Aliasing constructor
private:
// This constructor is non-standard, it is used by allocate_shared.
template<typename _Alloc, typename... _Args>
- shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
+ shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a,
+ _Args&&... __args)
: __shared_ptr<_Tp>(__tag, __a, std::forward<_Args>(__args)...)
{ }
template<typename _Tp1, typename _Alloc, typename... _Args>
friend shared_ptr<_Tp1>
- allocate_shared(_Alloc __a, _Args&&... __args);
+ allocate_shared(const _Alloc& __a, _Args&&... __args);
};
// 20.8.13.2.7 shared_ptr comparisons
*/
template<typename _Tp, typename _Alloc, typename... _Args>
inline shared_ptr<_Tp>
- allocate_shared(_Alloc __a, _Args&&... __args)
+ allocate_shared(const _Alloc& __a, _Args&&... __args)
{
- return shared_ptr<_Tp>(_Sp_make_shared_tag(), std::forward<_Alloc>(__a),
+ return shared_ptr<_Tp>(_Sp_make_shared_tag(), __a,
std::forward<_Args>(__args)...);
}
{
_Deleter _M_del; // copy constructor must not throw
_My_Deleter(_Deleter __d, const _Alloc& __a)
- : _My_alloc_type(__a), _M_del(__d) { }
+ : _My_alloc_type(__a), _M_del(__d) { }
};
protected:
}
template<typename _Tp, typename _Alloc, typename... _Args>
- __shared_count(_Sp_make_shared_tag, _Tp*, _Alloc __a, _Args&&... __args)
+ __shared_count(_Sp_make_shared_tag, _Tp*, const _Alloc& __a,
+ _Args&&... __args)
: _M_pi(0)
{
typedef _Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp> _Sp_cp_type;
}
template<typename _Tp1, typename _Deleter, typename _Alloc>
- __shared_ptr(_Tp1* __p, _Deleter __d, const _Alloc& __a)
- : _M_ptr(__p), _M_refcount(__p, __d, __a)
+ __shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a)
+ : _M_ptr(__p), _M_refcount(__p, __d, std::move(__a))
{
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
// TODO requires _Deleter CopyConstructible and __d(__p) well-formed
{ }
template<typename _Deleter, typename _Alloc>
- __shared_ptr(nullptr_t __p, _Deleter __d, const _Alloc& __a)
- : _M_ptr(0), _M_refcount(__p, __d, __a)
+ __shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a)
+ : _M_ptr(0), _M_refcount(__p, __d, std::move(__a))
{ }
template<typename _Tp1>
template<typename _Tp1, typename _Deleter, typename _Alloc>
void
- reset(_Tp1* __p, _Deleter __d, const _Alloc& __a)
- { __shared_ptr(__p, __d, __a).swap(*this); }
+ reset(_Tp1* __p, _Deleter __d, _Alloc __a)
+ { __shared_ptr(__p, __d, std::move(__a)).swap(*this); }
// Allow class instantiation when _Tp is [cv-qual] void.
typename std::add_lvalue_reference<_Tp>::type
protected:
// This constructor is non-standard, it is used by allocate_shared.
template<typename _Alloc, typename... _Args>
- __shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
+ __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a,
+ _Args&&... __args)
: _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a,
std::forward<_Args>(__args)...)
{
};
template<typename _Alloc, typename... _Args>
- __shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
+ __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a,
+ _Args&&... __args)
: _M_ptr(), _M_refcount()
{
typedef typename _Alloc::template rebind<_Tp>::other _Alloc2;
template<typename _Tp1, _Lock_policy _Lp1, typename _Alloc,
typename... _Args>
friend __shared_ptr<_Tp1, _Lp1>
- __allocate_shared(_Alloc __a, _Args&&... __args);
+ __allocate_shared(const _Alloc& __a, _Args&&... __args);
private:
void*
template<typename _Tp, _Lock_policy _Lp, typename _Alloc, typename... _Args>
inline __shared_ptr<_Tp, _Lp>
- __allocate_shared(_Alloc __a, _Args&&... __args)
+ __allocate_shared(const _Alloc& __a, _Args&&... __args)
{
- return __shared_ptr<_Tp, _Lp>(_Sp_make_shared_tag(),
- std::forward<_Alloc>(__a), std::forward<_Args>(__args)...);
+ return __shared_ptr<_Tp, _Lp>(_Sp_make_shared_tag(), __a,
+ std::forward<_Args>(__args)...);
}
template<typename _Tp, _Lock_policy _Lp, typename... _Args>
{
X* px = 0;
std::shared_ptr<X> p1(px); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 764 }
+ // { dg-error "incomplete" "" { target *-*-* } 765 }
std::shared_ptr<X> p9(ap()); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 856 }
+ // { dg-error "incomplete" "" { target *-*-* } 857 }
}
return 0;
}
-// { dg-warning "note" "" { target *-*-* } 350 }
-// { dg-warning "note" "" { target *-*-* } 1082 }
+// { dg-warning "note" "" { target *-*-* } 352 }
+// { dg-warning "note" "" { target *-*-* } 1085 }
// { dg-warning "note" "" { target *-*-* } 465 }
// { dg-warning "note" "" { target *-*-* } 585 }
// { dg-warning "note" "" { target *-*-* } 1027 }