aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <redi@gcc.gnu.org>2011-04-02 20:32:15 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2011-04-02 20:32:15 +0100
commit0569d07d16ea180369a421901402e99a915f7149 (patch)
treeb5a8d1233ca0a5e1bfcd27eb5bee2fa69ddb3307
parent79455ea1f897031fc4f3d9cccd6622c6e922ba4e (diff)
downloadgcc-0569d07d16ea180369a421901402e99a915f7149.zip
gcc-0569d07d16ea180369a421901402e99a915f7149.tar.gz
gcc-0569d07d16ea180369a421901402e99a915f7149.tar.bz2
re PR libstdc++/48398 ([C++0x] std::unique_ptr<T, D> is broken when D::pointer is not T*)
2011-04-02 Jonathan Wakely <redi@gcc.gnu.org> PR libstdc++/48398 * include/bits/unique_ptr.h (__tuple_type): Store pointer type. * testsuite/20_util/unique_ptr/modifiers/48398.cc: New. * testsuite/20_util/unique_ptr/requirements/pointer_type.cc: Remove unused parameter name. From-SVN: r171894
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/bits/unique_ptr.h6
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/48398.cc41
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/requirements/pointer_type.cc6
4 files changed, 55 insertions, 6 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 40bbf34c..0dd815f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2011-04-02 Jonathan Wakely <redi@gcc.gnu.org>
+
+ PR libstdc++/48398
+ * include/bits/unique_ptr.h (__tuple_type): Store pointer type.
+ * testsuite/20_util/unique_ptr/modifiers/48398.cc: New.
+ * testsuite/20_util/unique_ptr/requirements/pointer_type.cc: Remove
+ unused parameter name.
+
2011-03-31 Jeffrey Yasskin <jyasskin@google.com>
* libsupc++/exception_ptr.h: Forward-declare std::type_info.
diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h
index 1afc75b..9db6343 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -100,11 +100,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef decltype( __test<_Del>(0)) type;
};
- typedef std::tuple<_Tp*, _Dp> __tuple_type;
- __tuple_type _M_t;
+ typedef std::tuple<typename _Pointer::type, _Dp> __tuple_type;
+ __tuple_type _M_t;
public:
- typedef typename _Pointer::type pointer;
+ typedef typename _Pointer::type pointer;
typedef _Tp element_type;
typedef _Dp deleter_type;
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/48398.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/48398.cc
new file mode 100644
index 0000000..54948df
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/48398.cc
@@ -0,0 +1,41 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 20.7.1 Class template unique_ptr [unique.ptr]
+
+#include <memory>
+
+// PR libstdc++/48398
+
+struct my_deleter
+{
+ typedef int* pointer;
+
+ void operator()( pointer p ) { delete p; }
+};
+
+void test01()
+{
+ std::unique_ptr<void, my_deleter> p( new int() );
+
+ p.get();
+ p.reset();
+
+}
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/requirements/pointer_type.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/requirements/pointer_type.cc
index 5074844..55f28ca 100644
--- a/libstdc++-v3/testsuite/20_util/unique_ptr/requirements/pointer_type.cc
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/requirements/pointer_type.cc
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2010 Free Software Foundation
+// Copyright (C) 2010, 2011 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -25,13 +25,13 @@
struct A
{
- void operator()(void* p) const { }
+ void operator()(void*) const { }
};
struct B
{
typedef char* pointer;
- void operator()(pointer p) const { }
+ void operator()(pointer) const { }
};
int main()