[Bug libstdc++/48635] [C++0x] unique_ptr<T, D&> moves the deleter instead of copying it
paolo.carlini at oracle dot com
gcc-bugzilla@gcc.gnu.org
Sun Apr 17 19:45:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48635
--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-04-17 19:44:51 UTC ---
Ok... Do we have testcases for that?
By the way, I noticed that in the templated *constructor* we have been using D
instead of E in the forward, and that doesn't seem correct vs the FDIS itself.
What do you think? The below regtests fine:
Index: include/bits/unique_ptr.h
===================================================================
--- include/bits/unique_ptr.h (revision 172616)
+++ include/bits/unique_ptr.h (working copy)
@@ -153,7 +153,7 @@
&& std::is_convertible<_Ep, _Dp>::value))>
::type>
unique_ptr(unique_ptr<_Up, _Ep>&& __u)
- : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
+ : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
{ }
#if _GLIBCXX_USE_DEPRECATED
@@ -186,7 +186,7 @@
operator=(unique_ptr<_Up, _Ep>&& __u)
{
reset(__u.release());
- get_deleter() = std::forward<deleter_type>(__u.get_deleter());
+ get_deleter() = std::forward<_Ep>(__u.get_deleter());
return *this;
}
@@ -306,7 +306,7 @@
template<typename _Up, typename _Ep>
unique_ptr(unique_ptr<_Up, _Ep>&& __u)
- : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
+ : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
{ }
// Destructor.
@@ -326,7 +326,7 @@
operator=(unique_ptr<_Up, _Ep>&& __u)
{
reset(__u.release());
- get_deleter() = std::forward<deleter_type>(__u.get_deleter());
+ get_deleter() = std::forward<_Ep>(__u.get_deleter());
return *this;
}
More information about the Gcc-bugs
mailing list