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