Commit 22977dce by Paolo Carlini Committed by Paolo Carlini

generation_prohibited.c: Remove, swap can indeed throw (DR 774).

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.

From-SVN: r156419
parent 7adac79a
2010-01-31 Paolo Carlini <paolo.carlini@oracle.com> 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: Revert last changes. Also revert, among the previous changes:
* include/std/condition_variable (condition_variable_any:: * include/std/condition_variable (condition_variable_any::
wait<>(_Lock&)): Provide definition. wait<>(_Lock&)): Provide definition.
......
// <forward_list.h> -*- C++ -*- // <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 // 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
...@@ -859,6 +859,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -859,6 +859,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @param pos An iterator into the %forward_list. * @param pos An iterator into the %forward_list.
* @param n Number of elements to be inserted. * @param n Number of elements to be inserted.
* @param val Data to be inserted. * @param val Data to be inserted.
* @return pos.
* *
* This function will insert a specified number of copies of the * This function will insert a specified number of copies of the
* given data after the location specified by @a pos. * given data after the location specified by @a pos.
...@@ -866,11 +867,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -866,11 +867,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* This operation is linear in the number of elements inserted and * This operation is linear in the number of elements inserted and
* does not invalidate iterators and references. * does not invalidate iterators and references.
*/ */
void iterator
insert_after(const_iterator __pos, size_type __n, const _Tp& __val) insert_after(const_iterator __pos, size_type __n, const _Tp& __val)
{ {
forward_list __tmp(__n, __val, this->get_allocator()); forward_list __tmp(__n, __val, this->get_allocator());
splice_after(__pos, std::move(__tmp)); splice_after(__pos, std::move(__tmp));
return iterator(__const_pointer_cast<typename _Node_base::_Pointer>
(__pos._M_node));
} }
/** /**
...@@ -878,6 +881,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -878,6 +881,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @param position An iterator into the %forward_list. * @param position An iterator into the %forward_list.
* @param first An input iterator. * @param first An input iterator.
* @param last An input iterator. * @param last An input iterator.
* @return pos.
* *
* This function will insert copies of the data in the range [@a * This function will insert copies of the data in the range [@a
* first,@a last) into the %forward_list after the location specified * first,@a last) into the %forward_list after the location specified
...@@ -887,12 +891,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -887,12 +891,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* does not invalidate iterators and references. * does not invalidate iterators and references.
*/ */
template<typename _InputIterator> template<typename _InputIterator>
void iterator
insert_after(const_iterator __pos, insert_after(const_iterator __pos,
_InputIterator __first, _InputIterator __last) _InputIterator __first, _InputIterator __last)
{ {
forward_list __tmp(__first, __last, this->get_allocator()); forward_list __tmp(__first, __last, this->get_allocator());
splice_after(__pos, std::move(__tmp)); splice_after(__pos, std::move(__tmp));
return iterator(__const_pointer_cast<typename _Node_base::_Pointer>
(__pos._M_node));
} }
/** /**
...@@ -900,6 +906,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -900,6 +906,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* %forward_list after the specified iterator. * %forward_list after the specified iterator.
* @param pos An iterator into the %forward_list. * @param pos An iterator into the %forward_list.
* @param il An initializer_list of value_type. * @param il An initializer_list of value_type.
* @return pos.
* *
* This function will insert copies of the data in the * This function will insert copies of the data in the
* initializer_list @a il into the %forward_list before the location * initializer_list @a il into the %forward_list before the location
...@@ -908,11 +915,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -908,11 +915,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* This operation is linear in the number of elements inserted and * This operation is linear in the number of elements inserted and
* does not invalidate iterators and references. * does not invalidate iterators and references.
*/ */
void iterator
insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
{ {
forward_list __tmp(__il, this->get_allocator()); forward_list __tmp(__il, this->get_allocator());
splice_after(__pos, std::move(__tmp)); splice_after(__pos, std::move(__tmp));
return iterator(__const_pointer_cast<typename _Node_base::_Pointer>
(__pos._M_node));
} }
/** /**
......
// { 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" } // { 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 // 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
...@@ -38,7 +38,9 @@ test01() ...@@ -38,7 +38,9 @@ test01()
std::forward_list<int, _ExtPtr_allocator<int> > fl( std::forward_list<int, _ExtPtr_allocator<int> > fl(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); {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); VERIFY(fl.front() == 42);
} }
...@@ -49,15 +51,17 @@ test02() ...@@ -49,15 +51,17 @@ test02()
std::forward_list<int, _ExtPtr_allocator<int> > fl( std::forward_list<int, _ExtPtr_allocator<int> > fl(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); {0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator pos
pos = fl.cbegin(); = fl.cbegin();
++pos; ++pos;
VERIFY(*pos == 1); VERIFY(*pos == 1);
// Note: Calling l.insert_after(pos, 5, 42); without the long five // Note: Calling l.insert_after(pos, 5, 42); without the long five
// gets resolved to the iterator range version and fails to compile! // 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); VERIFY(*pos == 1);
++pos; ++pos;
...@@ -76,14 +80,16 @@ test03() ...@@ -76,14 +80,16 @@ test03()
std::forward_list<int, _ExtPtr_allocator<int> > fl( std::forward_list<int, _ExtPtr_allocator<int> > fl(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); {0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator pos
pos = fl.cbegin(); = fl.cbegin();
++pos; ++pos;
VERIFY(*pos == 1); VERIFY(*pos == 1);
int i[3] = {666, 777, 888}; 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); VERIFY(*pos == 1);
++pos; ++pos;
...@@ -107,7 +113,9 @@ test04() ...@@ -107,7 +113,9 @@ test04()
++pos; ++pos;
VERIFY(*pos == 1); 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); VERIFY(*pos == 1);
++pos; ++pos;
...@@ -123,16 +131,18 @@ test05() ...@@ -123,16 +131,18 @@ test05()
std::forward_list<std::string, _ExtPtr_allocator<std::string> > fl( std::forward_list<std::string, _ExtPtr_allocator<std::string> > fl(
{"AAA", "BBB", "CCC"}); {"AAA", "BBB", "CCC"});
std::forward_list<std::string, _ExtPtr_allocator<std::string> >::const_iterator std::forward_list<std::string, _ExtPtr_allocator<std::string> >::
pos = fl.cbegin(); const_iterator pos = fl.cbegin();
++pos; ++pos;
VERIFY(*pos == "BBB"); VERIFY(*pos == "BBB");
std::string x( "XXX" ); 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"); VERIFY(*pos == "BBB");
++pos; ++pos;
VERIFY(ret == pos);
VERIFY(*pos == "XXX"); VERIFY(*pos == "XXX");
++pos; ++pos;
VERIFY(*pos == "CCC"); VERIFY(*pos == "CCC");
......
// { dg-options "-std=gnu++0x" } // { 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 // 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
...@@ -34,7 +34,9 @@ test01() ...@@ -34,7 +34,9 @@ test01()
{ {
std::forward_list<int> fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); 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); VERIFY(fl.front() == 42);
} }
...@@ -50,7 +52,8 @@ test02() ...@@ -50,7 +52,8 @@ test02()
// Note: Calling l.insert_after(pos, 5, 42); without the long five // Note: Calling l.insert_after(pos, 5, 42); without the long five
// gets resolved to the iterator range version and fails to compile! // 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); VERIFY(*pos == 1);
++pos; ++pos;
...@@ -73,7 +76,8 @@ test03() ...@@ -73,7 +76,8 @@ test03()
VERIFY(*pos == 1); VERIFY(*pos == 1);
int i[3] = {666, 777, 888}; 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); VERIFY(*pos == 1);
++pos; ++pos;
...@@ -94,7 +98,9 @@ test04() ...@@ -94,7 +98,9 @@ test04()
++pos; ++pos;
VERIFY(*pos == 1); 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); VERIFY(*pos == 1);
++pos; ++pos;
...@@ -114,9 +120,11 @@ test05() ...@@ -114,9 +120,11 @@ test05()
VERIFY(*pos == "BBB"); VERIFY(*pos == "BBB");
std::string x( "XXX" ); 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"); VERIFY(*pos == "BBB");
++pos; ++pos;
VERIFY(ret == pos);
VERIFY(*pos == "XXX"); VERIFY(*pos == "XXX");
++pos; ++pos;
VERIFY(*pos == "CCC"); VERIFY(*pos == "CCC");
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1196 } // { dg-error "no matching" "" { target *-*-* } 1205 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation // Copyright (C) 2009, 2010 Free Software Foundation
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1196 } // { dg-error "no matching" "" { target *-*-* } 1205 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation // Copyright (C) 2009, 2010 Free Software Foundation
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1196 } // { dg-error "no matching" "" { target *-*-* } 1205 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation // Copyright (C) 2009, 2010 Free Software Foundation
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1196 } // { dg-error "no matching" "" { target *-*-* } 1205 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation // Copyright (C) 2009, 2010 Free Software Foundation
......
// -*- C++ -*- // -*- 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 // 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 // software; you can redistribute it and/or modify it under the terms
...@@ -512,10 +512,12 @@ namespace __gnu_test ...@@ -512,10 +512,12 @@ namespace __gnu_test
insert_base() : _F_insert_point(&container_type::insert) { } insert_base() : _F_insert_point(&container_type::insert) { }
}; };
template<typename _Tp1, typename _Tp2, typename _Tp3> template<typename _Tp1, typename _Tp2, typename _Tp3,
struct insert_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _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::iterator iterator;
typedef typename container_type::value_type value_type; typedef typename container_type::value_type value_type;
......
// -*- C++ -*- // -*- 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 // 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 // software; you can redistribute it and/or modify it under the terms
...@@ -135,7 +135,7 @@ namespace __gnu_test ...@@ -135,7 +135,7 @@ namespace __gnu_test
typedef std::true_type is_pointer_aware; typedef std::true_type is_pointer_aware;
typedef std::true_type has_erase; 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> template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
......
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