1 Upstream-Status: Inappropriate [Backport]
2 From 1934cdd502a4bad6e1c54c4206b9361909f01083 Mon Sep 17 00:00:00 2001
3 From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
4 Date: Sun, 17 Apr 2011 21:46:20 +0000
5 Subject: [PATCH 134/200] 2011-04-17 Daniel Krugler <daniel.kruegler@googlemail.com>
6 Paolo Carlini <paolo.carlini@oracle.com>
8 PR libstdc++/48635 (again)
9 * include/bits/unique_ptr.h (unique_ptr<>::unique_ptr(unique_ptr<>&&),
10 unique_ptr<_Tp[]>::unique_ptr(unique_ptr<>&&),
11 unique_ptr<>::operator=(unique_ptr<>&&),
12 unique_ptr<_Tp[]>::operator=(unique_ptr<>&&)): Use forward<_Ep>, not
13 forward<_Dp>, to forward the deleter.
14 * testsuite/20_util/unique_ptr/assign/48635_neg.cc: New.
17 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172620 138bc75d-0d04-0410-961f-82ee72b054a4
19 index 9ab1938..9d5d206 100644
20 --- a/libstdc++-v3/include/bits/unique_ptr.h
21 +++ b/libstdc++-v3/include/bits/unique_ptr.h
22 @@ -153,7 +153,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
23 && std::is_convertible<_Ep, _Dp>::value))>
25 unique_ptr(unique_ptr<_Up, _Ep>&& __u)
26 - : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
27 + : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
30 #if _GLIBCXX_USE_DEPRECATED
31 @@ -186,7 +186,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
32 operator=(unique_ptr<_Up, _Ep>&& __u)
35 - get_deleter() = std::forward<deleter_type>(__u.get_deleter());
36 + get_deleter() = std::forward<_Ep>(__u.get_deleter());
40 @@ -306,7 +306,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
42 template<typename _Up, typename _Ep>
43 unique_ptr(unique_ptr<_Up, _Ep>&& __u)
44 - : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
45 + : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
49 @@ -326,7 +326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 operator=(unique_ptr<_Up, _Ep>&& __u)
53 - get_deleter() = std::forward<deleter_type>(__u.get_deleter());
54 + get_deleter() = std::forward<_Ep>(__u.get_deleter());
58 diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc
60 index 0000000..1ed53ee
62 +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc
64 +// { dg-options "-std=gnu++0x" }
67 +// Copyright (C) 2011 Free Software Foundation
69 +// This file is part of the GNU ISO C++ Library. This library is free
70 +// software; you can redistribute it and/or modify it under the
71 +// terms of the GNU General Public License as published by the
72 +// Free Software Foundation; either version 3, or (at your option)
73 +// any later version.
75 +// This library is distributed in the hope that it will be useful,
76 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
77 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78 +// GNU General Public License for more details.
80 +// You should have received a copy of the GNU General Public License
81 +// along with this library; see the file COPYING3. If not see
82 +// <http://www.gnu.org/licenses/>.
90 + B& operator=(D&) = delete; // { dg-error "declared here" }
93 + void operator()(T*) const {}
104 + std::unique_ptr<int, B&> ub(nullptr, b);
105 + std::unique_ptr<int, D&> ud(nullptr, d);
106 + ub = std::move(ud);
107 +// { dg-error "use of deleted function" "" { target *-*-* } 189 }
109 + std::unique_ptr<int[], B&> uba(nullptr, b);
110 + std::unique_ptr<int[], D&> uda(nullptr, d);
111 + uba = std::move(uda);
112 +// { dg-error "use of deleted function" "" { target *-*-* } 329 }