Commit 37d5c6ba by Benjamin Kosnik

unique_ptr.h: Remove private __this_type typedef.

2009-02-04  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/unique_ptr.h: Remove private __this_type typedef.
	* include/bits/stl_vector.h: Remove private vector_type typedef.
	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
	Fix line numbers.
	* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_1_neg.cc: Same.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_2_neg.cc: Same.
	* testsuite/20_util/unique_ptr/modifiers/reset_neg.cc: Same.
	* testsuite/20_util/unique_ptr/assign/assign.cc: Same.

From-SVN: r143949
parent 5006381c
2009-02-04 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/unique_ptr.h: Remove private __this_type typedef.
* include/bits/stl_vector.h: Remove private vector_type typedef.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Fix line numbers.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/20_util/unique_ptr/modifiers/reset_neg.cc: Same.
* testsuite/20_util/unique_ptr/assign/assign.cc: Same.
2009-02-03 Paolo Carlini <paolo.carlini@oracle.com> 2009-02-03 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/25191 PR libstdc++/25191
......
...@@ -181,7 +181,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -181,7 +181,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
__glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
typedef _Vector_base<_Tp, _Alloc> _Base; typedef _Vector_base<_Tp, _Alloc> _Base;
typedef vector<_Tp, _Alloc> vector_type;
typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
public: public:
...@@ -190,8 +189,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -190,8 +189,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
typedef typename _Tp_alloc_type::const_pointer const_pointer; typedef typename _Tp_alloc_type::const_pointer const_pointer;
typedef typename _Tp_alloc_type::reference reference; typedef typename _Tp_alloc_type::reference reference;
typedef typename _Tp_alloc_type::const_reference const_reference; typedef typename _Tp_alloc_type::const_reference const_reference;
typedef __gnu_cxx::__normal_iterator<pointer, vector_type> iterator; typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
typedef __gnu_cxx::__normal_iterator<const_pointer, vector_type> typedef __gnu_cxx::__normal_iterator<const_pointer, vector>
const_iterator; const_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator;
......
// unique_ptr implementation -*- C++ -*- // unique_ptr implementation -*- C++ -*-
// Copyright (C) 2008 Free Software Foundation, Inc. // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -80,21 +80,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -80,21 +80,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
} }
}; };
/// 20.6.11.2 unique_ptr for single objects. /// 20.7.12.2 unique_ptr for single objects.
template <typename _Tp, typename _Tp_Deleter = default_delete<_Tp> > template <typename _Tp, typename _Tp_Deleter = default_delete<_Tp> >
class unique_ptr class unique_ptr
{ {
typedef unique_ptr<_Tp, _Tp_Deleter> __this_type;
typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type; typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type;
typedef __tuple_type __this_type::* __unspecified_bool_type; typedef __tuple_type unique_ptr::* __unspecified_bool_type;
typedef _Tp* __this_type::* __unspecified_pointer_type; typedef _Tp* unique_ptr::* __unspecified_pointer_type;
public: public:
typedef _Tp* pointer; typedef _Tp* pointer;
typedef _Tp element_type; typedef _Tp element_type;
typedef _Tp_Deleter deleter_type; typedef _Tp_Deleter deleter_type;
// constructors // Constructors.
unique_ptr() unique_ptr()
: _M_t(pointer(), deleter_type()) : _M_t(pointer(), deleter_type())
{ static_assert(!std::is_pointer<deleter_type>::value, { static_assert(!std::is_pointer<deleter_type>::value,
...@@ -117,8 +116,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -117,8 +116,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ static_assert(!std::is_reference<deleter_type>::value, { static_assert(!std::is_reference<deleter_type>::value,
"rvalue deleter bound to reference"); } "rvalue deleter bound to reference"); }
// move constructors // Move constructors.
unique_ptr(unique_ptr && __u) unique_ptr(unique_ptr&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { } : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
template<typename _Up, typename _Up_Deleter> template<typename _Up, typename _Up_Deleter>
...@@ -126,10 +125,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -126,10 +125,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
{ } { }
// destructor // Destructor.
~unique_ptr() { reset(); } ~unique_ptr() { reset(); }
// assignment // Assignment.
unique_ptr& unique_ptr&
operator=(unique_ptr&& __u) operator=(unique_ptr&& __u)
{ {
...@@ -154,7 +153,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -154,7 +153,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this; return *this;
} }
// observers // Observers.
typename std::add_lvalue_reference<element_type>::type operator*() const typename std::add_lvalue_reference<element_type>::type operator*() const
{ {
_GLIBCXX_DEBUG_ASSERT(get() != 0); _GLIBCXX_DEBUG_ASSERT(get() != 0);
...@@ -183,9 +182,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -183,9 +182,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return std::get<1>(_M_t); } { return std::get<1>(_M_t); }
operator __unspecified_bool_type () const operator __unspecified_bool_type () const
{ return get() == 0 ? 0 : &__this_type::_M_t; } { return get() == 0 ? 0 : &unique_ptr::_M_t; }
// modifiers // Modifiers.
pointer pointer
release() release()
{ {
...@@ -211,7 +210,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -211,7 +210,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
swap(_M_t, __u._M_t); swap(_M_t, __u._M_t);
} }
// disable copy from lvalue // Disable copy from lvalue.
unique_ptr(const unique_ptr&) = delete; unique_ptr(const unique_ptr&) = delete;
template<typename _Up, typename _Up_Deleter> template<typename _Up, typename _Up_Deleter>
...@@ -226,24 +225,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -226,24 +225,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__tuple_type _M_t; __tuple_type _M_t;
}; };
/// 20.6.11.3 unique_ptr for array objects with a runtime length /// 20.7.12.3 unique_ptr for array objects with a runtime length
// [unique.ptr.runtime] // [unique.ptr.runtime]
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 740 - omit specialization for array objects with a compile time length // DR 740 - omit specialization for array objects with a compile time length
template<typename _Tp, typename _Tp_Deleter> template<typename _Tp, typename _Tp_Deleter>
class unique_ptr<_Tp[], _Tp_Deleter> class unique_ptr<_Tp[], _Tp_Deleter>
{ {
typedef unique_ptr<_Tp[], _Tp_Deleter> __this_type;
typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type; typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type;
typedef __tuple_type __this_type::* __unspecified_bool_type; typedef __tuple_type unique_ptr::* __unspecified_bool_type;
typedef _Tp* __this_type::* __unspecified_pointer_type; typedef _Tp* unique_ptr::* __unspecified_pointer_type;
public: public:
typedef _Tp* pointer; typedef _Tp* pointer;
typedef _Tp element_type; typedef _Tp element_type;
typedef _Tp_Deleter deleter_type; typedef _Tp_Deleter deleter_type;
// constructors // Constructors.
unique_ptr() unique_ptr()
: _M_t(pointer(), deleter_type()) : _M_t(pointer(), deleter_type())
{ static_assert(!std::is_pointer<deleter_type>::value, { static_assert(!std::is_pointer<deleter_type>::value,
...@@ -266,7 +264,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -266,7 +264,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ static_assert(!std::is_reference<deleter_type>::value, { static_assert(!std::is_reference<deleter_type>::value,
"rvalue deleter bound to reference"); } "rvalue deleter bound to reference"); }
// move constructors // Move constructors.
unique_ptr(unique_ptr&& __u) unique_ptr(unique_ptr&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { } : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
...@@ -275,10 +273,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -275,10 +273,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
{ } { }
// destructor // Destructor.
~unique_ptr() { reset(); } ~unique_ptr() { reset(); }
// assignment // Assignment.
unique_ptr& unique_ptr&
operator=(unique_ptr&& __u) operator=(unique_ptr&& __u)
{ {
...@@ -303,7 +301,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -303,7 +301,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this; return *this;
} }
// observers // Observers.
typename std::add_lvalue_reference<element_type>::type typename std::add_lvalue_reference<element_type>::type
operator[](size_t __i) const operator[](size_t __i) const
{ {
...@@ -326,9 +324,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -326,9 +324,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return std::get<1>(_M_t); } { return std::get<1>(_M_t); }
operator __unspecified_bool_type () const operator __unspecified_bool_type () const
{ return get() == 0 ? 0 : &__this_type::_M_t; } { return get() == 0 ? 0 : &unique_ptr::_M_t; }
// modifiers // Modifiers.
pointer pointer
release() release()
{ {
...@@ -358,11 +356,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -358,11 +356,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
swap(_M_t, __u._M_t); swap(_M_t, __u._M_t);
} }
// disable copy from lvalue // Disable copy from lvalue.
unique_ptr(const unique_ptr&) = delete; unique_ptr(const unique_ptr&) = delete;
unique_ptr& operator=(const unique_ptr&) = delete; unique_ptr& operator=(const unique_ptr&) = delete;
// disable construction from convertible pointer types // Disable construction from convertible pointer types.
// (N2315 - 20.6.5.3.1) // (N2315 - 20.6.5.3.1)
template<typename _Up> template<typename _Up>
unique_ptr(_Up*, typename unique_ptr(_Up*, typename
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// Copyright (C) 2008 Free Software Foundation // Copyright (C) 2008, 2009 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -53,7 +53,7 @@ test03() ...@@ -53,7 +53,7 @@ test03()
// { dg-error "used here" "" { target *-*-* } 43 } // { dg-error "used here" "" { target *-*-* } 43 }
// { dg-error "no matching" "" { target *-*-* } 49 } // { dg-error "no matching" "" { target *-*-* } 49 }
// { dg-error "used here" "" { target *-*-* } 50 } // { dg-error "used here" "" { target *-*-* } 50 }
// { dg-error "candidates are" "" { target *-*-* } 215 } // { dg-error "candidates are" "" { target *-*-* } 214 }
// { dg-error "deleted function" "" { target *-*-* } 215 } // { dg-error "deleted function" "" { target *-*-* } 214 }
// { dg-error "deleted function" "" { target *-*-* } 362 } // { dg-error "deleted function" "" { target *-*-* } 360 }
// { dg-excess-errors "note" } // { dg-excess-errors "note" }
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// Copyright (C) 2008 Free Software Foundation // Copyright (C) 2008, 2009 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -37,4 +37,4 @@ void test01() ...@@ -37,4 +37,4 @@ void test01()
} }
// { dg-error "used here" "" { target *-*-* } 36 } // { dg-error "used here" "" { target *-*-* } 36 }
// { dg-error "deleted function" "" { target *-*-* } 352 } // { dg-error "deleted function" "" { target *-*-* } 350 }
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008 Free Software Foundation // Copyright (C) 2007, 2008, 2009 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// USA. // USA.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1058 } // { dg-error "no matching" "" { target *-*-* } 1057 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <vector> #include <vector>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008 Free Software Foundation // Copyright (C) 2007, 2008, 2009 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// USA. // USA.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 998 } // { dg-error "no matching" "" { target *-*-* } 997 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <vector> #include <vector>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008 Free Software Foundation // Copyright (C) 2007, 2008, 2009 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// USA. // USA.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 998 } // { dg-error "no matching" "" { target *-*-* } 997 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <vector> #include <vector>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008 Free Software Foundation // Copyright (C) 2007, 2008, 2009 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// USA. // USA.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1099 } // { dg-error "no matching" "" { target *-*-* } 1098 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <vector> #include <vector>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment