From: paolo Date: Sat, 9 Jan 2010 02:49:53 +0000 (+0000) Subject: 2010-01-08 Paolo Carlini X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=d79da0e907feba3c6a5ca258d7ded778cee56fed 2010-01-08 Paolo Carlini * include/debug/set.h: Protect move assignment operator vs self assignment. * include/debug/unordered_map: Likewise. * include/debug/multiset.h: Likewise. * include/debug/vector: Likewise. * include/debug/unordered_set: Likewise. * include/debug/deque: Likewise. * include/debug/map.h: Likewise. * include/debug/list: Likewise. * include/debug/multimap.h: Likewise. * include/tr1_impl/unordered_map: Likewise. * include/tr1_impl/unordered_set: Likewise. * include/profile/set.h: Likewise. * include/profile/unordered_map: Likewise. * include/profile/multiset.h: Likewise. * include/profile/unordered_set: Likewise. * include/profile/vector: Likewise. * include/profile/deque: Likewise. * include/profile/map.h: Likewise. * include/profile/list: Likewise. * include/profile/multimap.h: Likewise. * include/ext/vstring.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/ext/vstring.h: Use clear(). * testsuite/ext/vstring/cons/self_move_assign.cc: New. * testsuite/23_containers/unordered_map/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/multimap/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/set/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/unordered_multimap/cons/ self_move_assign.cc: Likewise. * testsuite/23_containers/forward_list/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/unordered_set/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/vector/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/deque/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/multiset/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/list/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/ self_move_assign.cc: Likewise. * testsuite/23_containers/map/cons/self_move_assign.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Adjust dg-error line numbers. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/ext/vstring/moveable.cc: Move to... * testsuite/ext/vstring/cons/moveable.cc: ... here. * testsuite/23_containers/unordered_map/moveable.cc: Move to... * testsuite/23_containers/unordered_map/cons/moveable.cc ... here. * testsuite/23_containers/multimap/moveable.cc: Move to... * testsuite/23_containers/multimap/cons/moveable.cc: ... here. * testsuite/23_containers/set/moveable.cc: Move to... * testsuite/23_containers/set/cons/moveable.cc: ... here. * testsuite/23_containers/unordered_multimap/moveable.cc: Move to... * testsuite/23_containers/unordered_multimap/cons/moveable.cc: ... here. * testsuite/23_containers/forward_list/moveable.cc: Move to... * testsuite/23_containers/forward_list/cons/moveable.cc: ... here. * testsuite/23_containers/unordered_set/moveable.cc Move to... * testsuite/23_containers/unordered_set/moveable.cc: ... here. * testsuite/23_containers/vector/cons/moveable.cc Move to... * testsuite/23_containers/vector/cons/moveable2.cc: ... this. * testsuite/23_containers/deque/cons/moveable.cc Move to... * testsuite/23_containers/deque/cons/moveable2.cc: ... this. * testsuite/23_containers/multiset/moveable.cc Move to... * testsuite/23_containers/multiset/cons/moveable.cc: ... here. * testsuite/23_containers/list/moveable.h Move to... * testsuite/23_containers/list/cons/moveable.h: ... here. * testsuite/23_containers/list/moveable.cc Move to... * testsuite/23_containers/list/cons/moveable.cc: ... here. * testsuite/23_containers/unordered_multiset/moveable.cc Move to... * testsuite/23_containers/unordered_multiset/cons/moveable.cc: ... here. * testsuite/23_containers/map/moveable.cc Move to... * testsuite/23_containers/map/cons/moveable.cc: ... here. * testsuite/23_containers/vector/moveable.cc: Move to... * testsuite/23_containers/vector/cons/moveable.cc: ... here. * testsuite/23_containers/deque/moveable.cc: Move to... * testsuite/23_containers/deque/cons/moveable.cc: ... here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155754 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 11e38434525..fe5de436971 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,116 @@ 2010-01-08 Paolo Carlini + * include/debug/set.h: Protect move assignment operator vs self + assignment. + * include/debug/unordered_map: Likewise. + * include/debug/multiset.h: Likewise. + * include/debug/vector: Likewise. + * include/debug/unordered_set: Likewise. + * include/debug/deque: Likewise. + * include/debug/map.h: Likewise. + * include/debug/list: Likewise. + * include/debug/multimap.h: Likewise. + * include/tr1_impl/unordered_map: Likewise. + * include/tr1_impl/unordered_set: Likewise. + * include/profile/set.h: Likewise. + * include/profile/unordered_map: Likewise. + * include/profile/multiset.h: Likewise. + * include/profile/unordered_set: Likewise. + * include/profile/vector: Likewise. + * include/profile/deque: Likewise. + * include/profile/map.h: Likewise. + * include/profile/list: Likewise. + * include/profile/multimap.h: Likewise. + * include/ext/vstring.h: Likewise. + * include/bits/stl_list.h: Likewise. + * include/bits/stl_map.h: Likewise. + * include/bits/stl_set.h: Likewise. + * include/bits/stl_multimap.h: Likewise. + * include/bits/stl_vector.h: Likewise. + * include/bits/stl_deque.h: Likewise. + * include/bits/stl_multiset.h: Likewise. + * include/ext/vstring.h: Use clear(). + * testsuite/ext/vstring/cons/self_move_assign.cc: New. + * testsuite/23_containers/unordered_map/cons/self_move_assign.cc: + Likewise. + * testsuite/23_containers/multimap/cons/self_move_assign.cc: Likewise. + * testsuite/23_containers/set/cons/self_move_assign.cc: Likewise. + * testsuite/23_containers/unordered_multimap/cons/ + self_move_assign.cc: Likewise. + * testsuite/23_containers/forward_list/cons/self_move_assign.cc: + Likewise. + * testsuite/23_containers/unordered_set/cons/self_move_assign.cc: + Likewise. + * testsuite/23_containers/vector/cons/self_move_assign.cc: Likewise. + * testsuite/23_containers/deque/cons/self_move_assign.cc: Likewise. + * testsuite/23_containers/multiset/cons/self_move_assign.cc: Likewise. + * testsuite/23_containers/list/cons/self_move_assign.cc: Likewise. + * testsuite/23_containers/unordered_multiset/cons/ + self_move_assign.cc: Likewise. + * testsuite/23_containers/map/cons/self_move_assign.cc: Likewise. + + * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: + Adjust dg-error line numbers. + * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: + Likewise. + * testsuite/23_containers/vector/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/vector/requirements/dr438/ + constructor_2_neg.cc: Likewise. + * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: + Likewise. + * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: + Likewise. + * testsuite/23_containers/deque/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/deque/requirements/dr438/ + constructor_2_neg.cc: Likewise. + * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: + Likewise. + * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: + Likewise. + * testsuite/23_containers/list/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/list/requirements/dr438/ + constructor_2_neg.cc: Likewise. + + * testsuite/ext/vstring/moveable.cc: Move to... + * testsuite/ext/vstring/cons/moveable.cc: ... here. + * testsuite/23_containers/unordered_map/moveable.cc: Move to... + * testsuite/23_containers/unordered_map/cons/moveable.cc ... here. + * testsuite/23_containers/multimap/moveable.cc: Move to... + * testsuite/23_containers/multimap/cons/moveable.cc: ... here. + * testsuite/23_containers/set/moveable.cc: Move to... + * testsuite/23_containers/set/cons/moveable.cc: ... here. + * testsuite/23_containers/unordered_multimap/moveable.cc: Move to... + * testsuite/23_containers/unordered_multimap/cons/moveable.cc: + ... here. + * testsuite/23_containers/forward_list/moveable.cc: Move to... + * testsuite/23_containers/forward_list/cons/moveable.cc: ... here. + * testsuite/23_containers/unordered_set/moveable.cc Move to... + * testsuite/23_containers/unordered_set/moveable.cc: ... here. + * testsuite/23_containers/vector/cons/moveable.cc Move to... + * testsuite/23_containers/vector/cons/moveable2.cc: ... this. + * testsuite/23_containers/deque/cons/moveable.cc Move to... + * testsuite/23_containers/deque/cons/moveable2.cc: ... this. + * testsuite/23_containers/multiset/moveable.cc Move to... + * testsuite/23_containers/multiset/cons/moveable.cc: ... here. + * testsuite/23_containers/list/moveable.h Move to... + * testsuite/23_containers/list/cons/moveable.h: ... here. + * testsuite/23_containers/list/moveable.cc Move to... + * testsuite/23_containers/list/cons/moveable.cc: ... here. + * testsuite/23_containers/unordered_multiset/moveable.cc Move to... + * testsuite/23_containers/unordered_multiset/cons/moveable.cc: + ... here. + * testsuite/23_containers/map/moveable.cc Move to... + * testsuite/23_containers/map/cons/moveable.cc: ... here. + * testsuite/23_containers/vector/moveable.cc: Move to... + * testsuite/23_containers/vector/cons/moveable.cc: ... here. + * testsuite/23_containers/deque/moveable.cc: Move to... + * testsuite/23_containers/deque/cons/moveable.cc: ... here. + +2010-01-08 Paolo Carlini + PR libstdc++/42573 * include/bits/allocator.h (struct __shrink_to_fit): Add. * include/bits/stl_deque.h (deque<>::shrink_to_fit): Add. diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index d327fc2f202..b0b2f4940d8 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -884,9 +884,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) deque& operator=(deque&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 51f8a8f931d..b6ce11382ef 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -1,6 +1,6 @@ // List implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -606,9 +606,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) list& operator=(list&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index a26e68a01c0..33364bfe917 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -1,6 +1,6 @@ // Map implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -265,9 +265,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) map& operator=(map&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index fa3f2539018..0bff20a0735 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -1,6 +1,6 @@ // Multimap implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -262,9 +262,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) multimap& operator=(multimap&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index 431cbae4302..bb84b6b7d08 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -1,6 +1,6 @@ // Multiset implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -234,9 +234,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) multiset& operator=(multiset&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index e87cccbab77..2388382ad31 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -1,6 +1,6 @@ // Set implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -241,9 +241,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) set& operator=(set&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index ab21a94e530..f681cf0e855 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -335,9 +335,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) vector& operator=(vector&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque index bb9aef9302d..1c9535ec756 100644 --- a/libstdc++-v3/include/debug/deque +++ b/libstdc++-v3/include/debug/deque @@ -110,9 +110,12 @@ namespace __debug deque& operator=(deque&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list index 3af008c6b17..78462e45905 100644 --- a/libstdc++-v3/include/debug/list +++ b/libstdc++-v3/include/debug/list @@ -112,9 +112,12 @@ namespace __debug list& operator=(list&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h index 9a558b59488..8ef28a19790 100644 --- a/libstdc++-v3/include/debug/map.h +++ b/libstdc++-v3/include/debug/map.h @@ -115,9 +115,12 @@ namespace __debug map& operator=(map&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h index f69a289cf65..4ef2990acd0 100644 --- a/libstdc++-v3/include/debug/multimap.h +++ b/libstdc++-v3/include/debug/multimap.h @@ -116,9 +116,12 @@ namespace __debug multimap& operator=(multimap&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h index 91909826d7a..4a7ed9e6688 100644 --- a/libstdc++-v3/include/debug/multiset.h +++ b/libstdc++-v3/include/debug/multiset.h @@ -113,9 +113,12 @@ namespace __debug multiset& operator=(multiset&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h index 769639d721b..99f83fa9aa8 100644 --- a/libstdc++-v3/include/debug/set.h +++ b/libstdc++-v3/include/debug/set.h @@ -113,9 +113,12 @@ namespace __debug set& operator=(set&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map index 999dcae58fc..61a3a0a3686 100644 --- a/libstdc++-v3/include/debug/unordered_map +++ b/libstdc++-v3/include/debug/unordered_map @@ -1,6 +1,6 @@ // Debugging unordered_map/unordered_multimap implementation -*- C++ -*- -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -115,9 +115,12 @@ namespace __debug unordered_map& operator=(unordered_map&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } @@ -388,9 +391,12 @@ namespace __debug unordered_multimap& operator=(unordered_multimap&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set index 4f27c3f375d..f704f016794 100644 --- a/libstdc++-v3/include/debug/unordered_set +++ b/libstdc++-v3/include/debug/unordered_set @@ -1,6 +1,6 @@ // Debugging unordered_set/unordered_multiset implementation -*- C++ -*- -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -115,9 +115,12 @@ namespace __debug unordered_set& operator=(unordered_set&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index 67733bca9f9..227905a513d 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -124,9 +124,12 @@ namespace __debug vector& operator=(vector&& __x) { - // NB: DR 675. - clear(); - swap(__x); + if (this != &__x) + { + // NB: DR 675. + clear(); + swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h index d1a4afba139..691915f5c7f 100644 --- a/libstdc++-v3/include/ext/vstring.h +++ b/libstdc++-v3/include/ext/vstring.h @@ -261,7 +261,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) operator=(__versa_string&& __str) { if (this != &__str) - this->swap(__str); + { + this->clear(); + this->swap(__str); + } return *this; } diff --git a/libstdc++-v3/include/profile/deque b/libstdc++-v3/include/profile/deque index d0859a4aa96..12f45d646fc 100644 --- a/libstdc++-v3/include/profile/deque +++ b/libstdc++-v3/include/profile/deque @@ -102,9 +102,12 @@ namespace __profile deque& operator=(deque&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/profile/list b/libstdc++-v3/include/profile/list index 59a468b6dc8..9979a5211b2 100644 --- a/libstdc++-v3/include/profile/list +++ b/libstdc++-v3/include/profile/list @@ -102,9 +102,12 @@ namespace __profile list& operator=(list&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/profile/map.h b/libstdc++-v3/include/profile/map.h index baa877db5fe..6335ee774f3 100644 --- a/libstdc++-v3/include/profile/map.h +++ b/libstdc++-v3/include/profile/map.h @@ -121,9 +121,12 @@ namespace __profile map& operator=(map&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/profile/multimap.h b/libstdc++-v3/include/profile/multimap.h index df4e02d93d3..c240e331aa6 100644 --- a/libstdc++-v3/include/profile/multimap.h +++ b/libstdc++-v3/include/profile/multimap.h @@ -1,6 +1,6 @@ // Profiling multimap implementation -*- 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 @@ -106,9 +106,12 @@ namespace __profile multimap& operator=(multimap&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/profile/multiset.h b/libstdc++-v3/include/profile/multiset.h index b44abc40aef..22c1c53738c 100644 --- a/libstdc++-v3/include/profile/multiset.h +++ b/libstdc++-v3/include/profile/multiset.h @@ -104,9 +104,12 @@ namespace __profile multiset& operator=(multiset&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/profile/set.h b/libstdc++-v3/include/profile/set.h index 6c6773c134e..c5d462747f7 100644 --- a/libstdc++-v3/include/profile/set.h +++ b/libstdc++-v3/include/profile/set.h @@ -104,9 +104,12 @@ namespace __profile set& operator=(set&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map index b8adc44108b..7ef629a9094 100644 --- a/libstdc++-v3/include/profile/unordered_map +++ b/libstdc++-v3/include/profile/unordered_map @@ -130,9 +130,12 @@ namespace __profile unordered_map& operator=(unordered_map&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } @@ -355,9 +358,12 @@ namespace __profile unordered_multimap& operator=(unordered_multimap&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/profile/unordered_set b/libstdc++-v3/include/profile/unordered_set index b350da0878e..8c9e7669c49 100644 --- a/libstdc++-v3/include/profile/unordered_set +++ b/libstdc++-v3/include/profile/unordered_set @@ -129,9 +129,12 @@ namespace __profile unordered_set& operator=(unordered_set&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } @@ -343,9 +346,12 @@ namespace __profile unordered_multiset& operator=(unordered_multiset&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/profile/vector b/libstdc++-v3/include/profile/vector index 0b1d7526935..5ae45323dcb 100644 --- a/libstdc++-v3/include/profile/vector +++ b/libstdc++-v3/include/profile/vector @@ -140,9 +140,12 @@ namespace __profile vector& operator=(vector&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/tr1_impl/unordered_map b/libstdc++-v3/include/tr1_impl/unordered_map index edf49789fa4..d6975900739 100644 --- a/libstdc++-v3/include/tr1_impl/unordered_map +++ b/libstdc++-v3/include/tr1_impl/unordered_map @@ -229,9 +229,12 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 unordered_map& operator=(unordered_map&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } @@ -312,9 +315,12 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 unordered_multimap& operator=(unordered_multimap&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/include/tr1_impl/unordered_set b/libstdc++-v3/include/tr1_impl/unordered_set index d52b1517d91..1270b17186a 100644 --- a/libstdc++-v3/include/tr1_impl/unordered_set +++ b/libstdc++-v3/include/tr1_impl/unordered_set @@ -1,6 +1,6 @@ // TR1 unordered_set -*- C++ -*- -// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -222,9 +222,12 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 unordered_set& operator=(unordered_set&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } @@ -302,9 +305,12 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 unordered_multiset& operator=(unordered_multiset&& __x) { - // NB: DR 675. - this->clear(); - this->swap(__x); + if (this != &__x) + { + // NB: DR 675. + this->clear(); + this->swap(__x); + } return *this; } diff --git a/libstdc++-v3/testsuite/23_containers/deque/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/deque/cons/moveable.cc index 2d5edb4c25b..57113f5fb2e 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/cons/moveable.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/cons/moveable.cc @@ -1,4 +1,3 @@ -// { dg-do compile } // { dg-options "-std=gnu++0x" } // Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc. @@ -19,37 +18,25 @@ // . -#include -#include -#include -#include - -using namespace __gnu_test; -typedef std::deque test_type; - -// Empty constructor doesn't require a copy constructor -void -test01() -{ test_type d; } - -// Constructing from a range that returns rvalue references doesn't -// require a copy constructor. -void -test02(rvalstruct* begin, rvalstruct* end) -{ - test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); -} +// NOTE: This makes use of the fact that we know how moveable +// is implemented on deque (via swap). If the implementation changed +// this test may begin to fail. -// Constructing from a input iterator range that returns rvalue -// references doesn't require a copy constructor either. -void -test03(input_iterator_wrapper begin, - input_iterator_wrapper end) -{ - test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +#include +#include +#include + +int main() +{ + bool test __attribute__((unused)) = true; + + std::deque a,b; + a.push_back(1); + b = std::move(a); + VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 ); + + std::deque c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == 1 ); + VERIFY( b.size() == 0 ); + return 0; } - -// Neither does destroying one. -void -test04(test_type* d) -{ delete d; } diff --git a/libstdc++-v3/testsuite/23_containers/deque/cons/moveable2.cc b/libstdc++-v3/testsuite/23_containers/deque/cons/moveable2.cc new file mode 100644 index 00000000000..2d5edb4c25b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/cons/moveable2.cc @@ -0,0 +1,55 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007, 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 +// . + + +#include +#include +#include +#include + +using namespace __gnu_test; +typedef std::deque test_type; + +// Empty constructor doesn't require a copy constructor +void +test01() +{ test_type d; } + +// Constructing from a range that returns rvalue references doesn't +// require a copy constructor. +void +test02(rvalstruct* begin, rvalstruct* end) +{ + test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +} + +// Constructing from a input iterator range that returns rvalue +// references doesn't require a copy constructor either. +void +test03(input_iterator_wrapper begin, + input_iterator_wrapper end) +{ + test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +} + +// Neither does destroying one. +void +test04(test_type* d) +{ delete d; } diff --git a/libstdc++-v3/testsuite/23_containers/deque/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/deque/cons/self_move_assign.cc new file mode 100644 index 00000000000..e3c5180f5de --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/cons/self_move_assign.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::deque d0(10, 1); + const std::deque d1(d0); + d0 = std::move(d0); + VERIFY( d0.size() == 10 ); + VERIFY( d0 == d1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc index 0ab463da821..0a50b6d9220 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1575 } +// { dg-error "no matching" "" { target *-*-* } 1578 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc index f5265634130..a63fcfa5ea6 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1514 } +// { dg-error "no matching" "" { target *-*-* } 1517 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc index 4ef1fc1b92d..298ec2de532 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1514 } +// { dg-error "no matching" "" { target *-*-* } 1517 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc index df837568c68..cb303949ac8 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1659 } +// { dg-error "no matching" "" { target *-*-* } 1662 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/moveable.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/forward_list/moveable.cc rename to libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/deque/moveable.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/self_move_assign.cc similarity index 65% rename from libstdc++-v3/testsuite/23_containers/deque/moveable.cc rename to libstdc++-v3/testsuite/23_containers/forward_list/cons/self_move_assign.cc index 57113f5fb2e..d7b7298c67f 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/moveable.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/self_move_assign.cc @@ -1,6 +1,8 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc. +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 @@ -17,26 +19,22 @@ // with this library; see the file COPYING3. If not see // . - -// NOTE: This makes use of the fact that we know how moveable -// is implemented on deque (via swap). If the implementation changed -// this test may begin to fail. - -#include -#include +#include #include -int main() +void test01() { bool test __attribute__((unused)) = true; - std::deque a,b; - a.push_back(1); - b = std::move(a); - VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 ); + std::forward_list fl0(10, 1); + const std::forward_list fl1(fl0); + fl0 = std::move(fl0); + // VERIFY( fl0.size() == 10 ); + VERIFY( fl0 == fl1 ); +} - std::deque c(std::move(b)); - VERIFY( c.size() == 1 && c[0] == 1 ); - VERIFY( b.size() == 0 ); +int main() +{ + test01(); return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/list/moveable.cc b/libstdc++-v3/testsuite/23_containers/list/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/list/moveable.cc rename to libstdc++-v3/testsuite/23_containers/list/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/list/moveable.h b/libstdc++-v3/testsuite/23_containers/list/cons/moveable.h similarity index 100% rename from libstdc++-v3/testsuite/23_containers/list/moveable.h rename to libstdc++-v3/testsuite/23_containers/list/cons/moveable.h diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/list/cons/self_move_assign.cc new file mode 100644 index 00000000000..d406ecda4b3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/cons/self_move_assign.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::list l0(10, 1); + const std::list l1(l0); + l0 = std::move(l0); + VERIFY( l0.size() == 10 ); + VERIFY( l0 == l1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc index a9ef74472bf..24ee3fac6e7 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini -// Copyright (C) 2007, 2008, 2009 Free Software Foundation +// Copyright (C) 2007, 2008, 2009, 2010 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 @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1409 } +// { dg-error "no matching" "" { target *-*-* } 1412 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc index a3e29627f8d..3e0f7d936cb 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1378 } +// { dg-error "no matching" "" { target *-*-* } 1381 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc index f90ed940727..ec29e3b0f08 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini -// Copyright (C) 2007, 2008, 2009 Free Software Foundation +// Copyright (C) 2007, 2008, 2009, 2010 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 @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1378 } +// { dg-error "no matching" "" { target *-*-* } 1381 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc index 24bcee0c7fd..0d4a001c117 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini -// Copyright (C) 2007, 2008, 2009 Free Software Foundation +// Copyright (C) 2007, 2008, 2009, 2010 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 @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1378 } +// { dg-error "no matching" "" { target *-*-* } 1381 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/map/moveable.cc b/libstdc++-v3/testsuite/23_containers/map/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/map/moveable.cc rename to libstdc++-v3/testsuite/23_containers/map/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/map/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/map/cons/self_move_assign.cc new file mode 100644 index 00000000000..dbf153caecc --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/cons/self_move_assign.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::map map_type; + typedef map_type::value_type value_type; + + map_type m0{ value_type(1, 1), value_type(2, 2), value_type(3, 3) }; + + const map_type m1(m0); + m0 = std::move(m0); + VERIFY( m0.size() == 3 ); + VERIFY( m0 == m1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multimap/moveable.cc b/libstdc++-v3/testsuite/23_containers/multimap/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/multimap/moveable.cc rename to libstdc++-v3/testsuite/23_containers/multimap/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/multimap/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/multimap/cons/self_move_assign.cc new file mode 100644 index 00000000000..0d2f9e7b8c8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/cons/self_move_assign.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::multimap mmap_type; + typedef mmap_type::value_type value_type; + + mmap_type mm0{ value_type(1, 1), value_type(2, 2), value_type(3, 3) }; + + const mmap_type mm1(mm0); + mm0 = std::move(mm0); + VERIFY( mm0.size() == 3 ); + VERIFY( mm0 == mm1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/moveable.cc b/libstdc++-v3/testsuite/23_containers/multiset/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/multiset/moveable.cc rename to libstdc++-v3/testsuite/23_containers/multiset/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/multiset/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/multiset/cons/self_move_assign.cc new file mode 100644 index 00000000000..f1e4e1d33ab --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/cons/self_move_assign.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::multiset mset_type; + + mset_type ms0{ 1, 2, 3 }; + + const mset_type ms1(ms0); + ms0 = std::move(ms0); + VERIFY( ms0.size() == 3 ); + VERIFY( ms0 == ms1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/moveable.cc b/libstdc++-v3/testsuite/23_containers/set/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/set/moveable.cc rename to libstdc++-v3/testsuite/23_containers/set/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/set/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/set/cons/self_move_assign.cc new file mode 100644 index 00000000000..d8f676b635b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/cons/self_move_assign.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::set set_type; + + set_type s0{ 1, 2, 3 }; + + const set_type s1(s0); + s0 = std::move(s0); + VERIFY( s0.size() == 3 ); + VERIFY( s0 == s1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/unordered_map/moveable.cc rename to libstdc++-v3/testsuite/23_containers/unordered_map/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/self_move_assign.cc new file mode 100644 index 00000000000..a31a1ee7fd8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/self_move_assign.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_map umap_type; + typedef umap_type::value_type value_type; + + umap_type um0{ value_type(1, 1), value_type(2, 2), value_type(3, 3) }; + + const umap_type um1(um0); + um0 = std::move(um0); + VERIFY( um0.size() == 3 ); + // VERIFY( um0 == um1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/unordered_multimap/moveable.cc rename to libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/self_move_assign.cc new file mode 100644 index 00000000000..c44e8d8bfb5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/self_move_assign.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap ummap_type; + typedef ummap_type::value_type value_type; + + ummap_type umm0{ value_type(1, 1), value_type(2, 2), value_type(3, 3) }; + + const ummap_type umm1(umm0); + umm0 = std::move(umm0); + VERIFY( umm0.size() == 3 ); + // VERIFY( umm0 == umm1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/unordered_multiset/moveable.cc rename to libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/self_move_assign.cc new file mode 100644 index 00000000000..7929f6bef3b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/self_move_assign.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multiset umset_type; + + umset_type ums0{ 1, 2, 3 }; + + const umset_type ums1(ums0); + ums0 = std::move(ums0); + VERIFY( ums0.size() == 3 ); + // VERIFY( ums0 == ums1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/23_containers/unordered_set/moveable.cc rename to libstdc++-v3/testsuite/23_containers/unordered_set/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/self_move_assign.cc new file mode 100644 index 00000000000..7ce6db0172e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/self_move_assign.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_set uset_type; + + uset_type us0{ 1, 2, 3 }; + + const uset_type us1(us0); + us0 = std::move(us0); + VERIFY( us0.size() == 3 ); + // VERIFY( us0 == us1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc index ab04ccf0c15..8807ad9b4a4 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc @@ -1,4 +1,3 @@ -// { dg-do compile } // { dg-options "-std=gnu++0x" } // Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc. @@ -19,37 +18,45 @@ // . +// NOTE: This makes use of the fact that we know how moveable +// is implemented on vector (via swap). If the implementation changed +// this test may begin to fail. + #include -#include -#include -#include - -using namespace __gnu_test; -typedef std::vector test_type; - -// Empty constructor doesn't require a copy constructor -void -test01() -{ test_type d; } - -// Constructing from a range that returns rvalue references doesn't -// require a copy constructor. -void -test02(rvalstruct* begin, rvalstruct* end) -{ - test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::vector a,b; + a.push_back(1); + b = std::move(a); + VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 ); + + std::vector c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == 1 ); + VERIFY( b.size() == 0 ); } -// Constructing from a input iterator range that returns rvalue -// references doesn't require a copy constructor either. -void -test03(input_iterator_wrapper begin, - input_iterator_wrapper end) -{ - test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +void test02() +{ + bool test __attribute__((unused)) = true; + + std::vector a,b; + a.push_back(1); + b = std::move(a); + VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 ); + + std::vector c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == 1 ); + VERIFY( b.size() == 0 ); } -// Neither does destroying one. -void -test04(test_type* d) -{ delete d; } +int main(void) +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/moveable2.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable2.cc new file mode 100644 index 00000000000..ab04ccf0c15 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable2.cc @@ -0,0 +1,55 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007, 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 +// . + + +#include +#include +#include +#include + +using namespace __gnu_test; +typedef std::vector test_type; + +// Empty constructor doesn't require a copy constructor +void +test01() +{ test_type d; } + +// Constructing from a range that returns rvalue references doesn't +// require a copy constructor. +void +test02(rvalstruct* begin, rvalstruct* end) +{ + test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +} + +// Constructing from a input iterator range that returns rvalue +// references doesn't require a copy constructor either. +void +test03(input_iterator_wrapper begin, + input_iterator_wrapper end) +{ + test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +} + +// Neither does destroying one. +void +test04(test_type* d) +{ delete d; } diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/self_move_assign.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/self_move_assign.cc new file mode 100644 index 00000000000..d7c5d285465 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/self_move_assign.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::vector v0(10, 1); + const std::vector v1(v0); + v0 = std::move(v0); + VERIFY( v0.size() == 10 ); + VERIFY( v0 == v1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/moveable.cc deleted file mode 100644 index 8807ad9b4a4..00000000000 --- a/libstdc++-v3/testsuite/23_containers/vector/moveable.cc +++ /dev/null @@ -1,62 +0,0 @@ -// { dg-options "-std=gnu++0x" } - -// Copyright (C) 2005, 2007, 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 -// . - - -// NOTE: This makes use of the fact that we know how moveable -// is implemented on vector (via swap). If the implementation changed -// this test may begin to fail. - -#include -#include -#include - -void test01() -{ - bool test __attribute__((unused)) = true; - - std::vector a,b; - a.push_back(1); - b = std::move(a); - VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 ); - - std::vector c(std::move(b)); - VERIFY( c.size() == 1 && c[0] == 1 ); - VERIFY( b.size() == 0 ); -} - -void test02() -{ - bool test __attribute__((unused)) = true; - - std::vector a,b; - a.push_back(1); - b = std::move(a); - VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 ); - - std::vector c(std::move(b)); - VERIFY( c.size() == 1 && c[0] == 1 ); - VERIFY( b.size() == 0 ); -} - -int main(void) -{ - test01(); - test02(); - return 0; -} diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc index 8bab7374da9..bb9a56e924f 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1054 } +// { dg-error "no matching" "" { target *-*-* } 1057 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc index 0ff3d3b5dbc..02ae1c4c727 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 994 } +// { dg-error "no matching" "" { target *-*-* } 997 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc index 3f51e0db49a..f9c3f4a2205 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 994 } +// { dg-error "no matching" "" { target *-*-* } 997 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc index f710a584a6c..82acbbc97b9 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1095 } +// { dg-error "no matching" "" { target *-*-* } 1098 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/ext/vstring/moveable.cc b/libstdc++-v3/testsuite/ext/vstring/cons/moveable.cc similarity index 100% rename from libstdc++-v3/testsuite/ext/vstring/moveable.cc rename to libstdc++-v3/testsuite/ext/vstring/cons/moveable.cc diff --git a/libstdc++-v3/testsuite/ext/vstring/cons/self_move_assign.cc b/libstdc++-v3/testsuite/ext/vstring/cons/self_move_assign.cc new file mode 100644 index 00000000000..caa8e4ff9ab --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/cons/self_move_assign.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-string-conversions "" } + +// 2010-01-08 Paolo Carlini + +// Copyright (C) 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 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 +// . + +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::__vstring vs0(10, 'a'); + const __gnu_cxx::__vstring vs1(vs0); + vs0 = std::move(vs0); + VERIFY( vs0.size() == 10 ); + VERIFY( vs0 == vs1 ); +} + +int main() +{ + test01(); + return 0; +}