* testsuite/23_containers/array/requirements/exception/
generation_prohibited.c: Remove, swap can indeed throw (DR 774).
* testsuite/util/exception/safety.h (insert_base<__versa_string>): Fix.
* testsuite/util/testsuite_container_traits.h
(traits<__versa_string>): Enable insert tests.
2010-01-31 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/forward_list.h (forward_list<>::insert_after
(const_iterator, size_type, const _Tp&), insert_after(const_iterator,
_InputIterator, _InputIterator), insert_after(const_iterator,
std::initializer_list<>)): Fix return type per N3000.
* testsuite/23_containers/forward_list/ext_pointer/modifiers/2.cc:
Adjust.
* testsuite/23_containers/forward_list/modifiers/2.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Adjust dg-error line numbers.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156419
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-01-31 Paolo Carlini <paolo.carlini@oracle.com>
+ * testsuite/23_containers/array/requirements/exception/
+ generation_prohibited.c: Remove, swap can indeed throw (DR 774).
+
+ * testsuite/util/exception/safety.h (insert_base<__versa_string>): Fix.
+ * testsuite/util/testsuite_container_traits.h
+ (traits<__versa_string>): Enable insert tests.
+
+2010-01-31 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/forward_list.h (forward_list<>::insert_after
+ (const_iterator, size_type, const _Tp&), insert_after(const_iterator,
+ _InputIterator, _InputIterator), insert_after(const_iterator,
+ std::initializer_list<>)): Fix return type per N3000.
+ * testsuite/23_containers/forward_list/ext_pointer/modifiers/2.cc:
+ Adjust.
+ * testsuite/23_containers/forward_list/modifiers/2.cc: Likewise.
+ * testsuite/23_containers/forward_list/requirements/dr438/
+ assign_neg.cc: Adjust dg-error line numbers.
+ * testsuite/23_containers/forward_list/requirements/dr438/
+ insert_neg.cc: Likewise.
+ * testsuite/23_containers/forward_list/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/forward_list/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+
+2010-01-31 Paolo Carlini <paolo.carlini@oracle.com>
+
Revert last changes. Also revert, among the previous changes:
* include/std/condition_variable (condition_variable_any::
wait<>(_Lock&)): Provide definition.
// <forward_list.h> -*- C++ -*-
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// 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
* @param pos An iterator into the %forward_list.
* @param n Number of elements to be inserted.
* @param val Data to be inserted.
+ * @return pos.
*
* This function will insert a specified number of copies of the
* given data after the location specified by @a pos.
* This operation is linear in the number of elements inserted and
* does not invalidate iterators and references.
*/
- void
+ iterator
insert_after(const_iterator __pos, size_type __n, const _Tp& __val)
{
forward_list __tmp(__n, __val, this->get_allocator());
splice_after(__pos, std::move(__tmp));
+ return iterator(__const_pointer_cast<typename _Node_base::_Pointer>
+ (__pos._M_node));
}
/**
* @param position An iterator into the %forward_list.
* @param first An input iterator.
* @param last An input iterator.
+ * @return pos.
*
* This function will insert copies of the data in the range [@a
* first,@a last) into the %forward_list after the location specified
* does not invalidate iterators and references.
*/
template<typename _InputIterator>
- void
+ iterator
insert_after(const_iterator __pos,
_InputIterator __first, _InputIterator __last)
{
forward_list __tmp(__first, __last, this->get_allocator());
splice_after(__pos, std::move(__tmp));
+ return iterator(__const_pointer_cast<typename _Node_base::_Pointer>
+ (__pos._M_node));
}
/**
* %forward_list after the specified iterator.
* @param pos An iterator into the %forward_list.
* @param il An initializer_list of value_type.
+ * @return pos.
*
* This function will insert copies of the data in the
* initializer_list @a il into the %forward_list before the location
* This operation is linear in the number of elements inserted and
* does not invalidate iterators and references.
*/
- void
+ iterator
insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
{
forward_list __tmp(__il, this->get_allocator());
splice_after(__pos, std::move(__tmp));
+ return iterator(__const_pointer_cast<typename _Node_base::_Pointer>
+ (__pos._M_node));
}
/**
+++ /dev/null
-// { dg-options "-std=gnu++0x -D_GLIBCXX_IS_AGGREGATE" }
-// { dg-require-cstdint "" }
-// { dg-do run { xfail *-*-* } }
-
-// 2009-09-09 Benjamin Kosnik <benjamin@redhat.com>
-
-// Copyright (C) 2009 Free Software Foundation, Inc.
-//
-// 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/>.
-
-#include <array>
-#include <exception/safety.h>
-
-// Container requirement testing, exceptional behavior
-int main()
-{
- typedef __gnu_cxx::throw_value_random value_type;
- typedef std::array<value_type, 129> test_type;
- __gnu_test::generation_prohibited<test_type> test;
- return 0;
-}
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// 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
std::forward_list<int, _ExtPtr_allocator<int> > fl(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- fl.insert_after(fl.before_begin(), 42);
+ std::forward_list<int, _ExtPtr_allocator<int> >::iterator ret
+ = fl.insert_after(fl.before_begin(), 42);
+ VERIFY(ret == fl.begin());
VERIFY(fl.front() == 42);
}
std::forward_list<int, _ExtPtr_allocator<int> > fl(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator
- pos = fl.cbegin();
+ std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator pos
+ = fl.cbegin();
++pos;
VERIFY(*pos == 1);
// Note: Calling l.insert_after(pos, 5, 42); without the long five
// gets resolved to the iterator range version and fails to compile!
- fl.insert_after(pos, 5, 42);
+ std::forward_list<int, _ExtPtr_allocator<int> >::iterator ret
+ = fl.insert_after(pos, 5, 42);
+ VERIFY(ret == pos);
VERIFY(*pos == 1);
++pos;
std::forward_list<int, _ExtPtr_allocator<int> > fl(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator
- pos = fl.cbegin();
+ std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator pos
+ = fl.cbegin();
++pos;
VERIFY(*pos == 1);
int i[3] = {666, 777, 888};
- fl.insert_after(pos, i, i+3);
+ std::forward_list<int, _ExtPtr_allocator<int> >::iterator ret
+ = fl.insert_after(pos, i, i + 3);
+ VERIFY(ret == pos);
VERIFY(*pos == 1);
++pos;
++pos;
VERIFY(*pos == 1);
- fl.insert_after(pos, {-1, -2, -3, -4, -5});
+ std::forward_list<int, _ExtPtr_allocator<int> >::iterator ret
+ = fl.insert_after(pos, {-1, -2, -3, -4, -5});
+ VERIFY(ret == pos);
VERIFY(*pos == 1);
++pos;
std::forward_list<std::string, _ExtPtr_allocator<std::string> > fl(
{"AAA", "BBB", "CCC"});
- std::forward_list<std::string, _ExtPtr_allocator<std::string> >::const_iterator
- pos = fl.cbegin();
+ std::forward_list<std::string, _ExtPtr_allocator<std::string> >::
+ const_iterator pos = fl.cbegin();
++pos;
VERIFY(*pos == "BBB");
std::string x( "XXX" );
- fl.insert_after(pos, std::move(x));
+ std::forward_list<std::string, _ExtPtr_allocator<std::string> >::iterator ret
+ = fl.insert_after(pos, std::move(x));
VERIFY(*pos == "BBB");
++pos;
+ VERIFY(ret == pos);
VERIFY(*pos == "XXX");
++pos;
VERIFY(*pos == "CCC");
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// 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
{
std::forward_list<int> fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- fl.insert_after(fl.before_begin(), 42);
+ std::forward_list<int>::iterator ret = fl.insert_after(fl.before_begin(),
+ 42);
+ VERIFY(ret == fl.begin());
VERIFY(fl.front() == 42);
}
// Note: Calling l.insert_after(pos, 5, 42); without the long five
// gets resolved to the iterator range version and fails to compile!
- fl.insert_after(pos, 5, 42);
+ std::forward_list<int>::iterator ret = fl.insert_after(pos, 5, 42);
+ VERIFY(ret == pos);
VERIFY(*pos == 1);
++pos;
VERIFY(*pos == 1);
int i[3] = {666, 777, 888};
- fl.insert_after(pos, i, i+3);
+ std::forward_list<int>::iterator ret = fl.insert_after(pos, i, i + 3);
+ VERIFY(ret == pos);
VERIFY(*pos == 1);
++pos;
++pos;
VERIFY(*pos == 1);
- fl.insert_after(pos, {-1, -2, -3, -4, -5});
+ std::forward_list<int>::iterator ret
+ = fl.insert_after(pos, {-1, -2, -3, -4, -5});
+ VERIFY(ret == pos);
VERIFY(*pos == 1);
++pos;
VERIFY(*pos == "BBB");
std::string x( "XXX" );
- fl.insert_after(pos, std::move(x));
+ std::forward_list<std::string>::iterator ret
+ = fl.insert_after(pos, std::move(x));
VERIFY(*pos == "BBB");
++pos;
+ VERIFY(ret == pos);
VERIFY(*pos == "XXX");
++pos;
VERIFY(*pos == "CCC");
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1196 }
+// { dg-error "no matching" "" { target *-*-* } 1205 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1196 }
+// { dg-error "no matching" "" { target *-*-* } 1205 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1196 }
+// { dg-error "no matching" "" { target *-*-* } 1205 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1196 }
+// { dg-error "no matching" "" { target *-*-* } 1205 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
// -*- C++ -*-
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// 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
insert_base() : _F_insert_point(&container_type::insert) { }
};
- template<typename _Tp1, typename _Tp2, typename _Tp3>
- struct insert_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3>>
+ template<typename _Tp1, typename _Tp2, typename _Tp3,
+ template <typename, typename, typename> class _Tp4>
+ struct insert_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>>
{
- typedef __gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3> container_type;
+ typedef __gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>
+ container_type;
typedef typename container_type::iterator iterator;
typedef typename container_type::value_type value_type;
// -*- C++ -*-
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// 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
typedef std::true_type is_pointer_aware;
typedef std::true_type has_erase;
- //typedef std::true_type has_insert; XXX no vstring<rc>::insert
+ typedef std::true_type has_insert;
};
template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>