From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../testsuite/23_containers/multiset/14340.cc | 34 +++++ .../testsuite/23_containers/multiset/23781_neg.cc | 28 ++++ .../23_containers/multiset/capacity/29134.cc | 38 +++++ .../23_containers/multiset/cons/moveable.cc | 43 ++++++ .../23_containers/multiset/debug/construct1_neg.cc | 33 ++++ .../23_containers/multiset/debug/construct2_neg.cc | 33 ++++ .../23_containers/multiset/debug/construct3_neg.cc | 33 ++++ .../23_containers/multiset/debug/construct4_neg.cc | 32 ++++ .../23_containers/multiset/debug/insert1_neg.cc | 33 ++++ .../23_containers/multiset/debug/insert2_neg.cc | 33 ++++ .../23_containers/multiset/debug/insert3_neg.cc | 33 ++++ .../23_containers/multiset/debug/insert4_neg.cc | 32 ++++ .../23_containers/multiset/debug/invalidation/1.cc | 51 +++++++ .../23_containers/multiset/debug/invalidation/2.cc | 69 +++++++++ .../testsuite/23_containers/multiset/dr130.cc | 85 +++++++++++ .../testsuite/23_containers/multiset/init-list.cc | 59 ++++++++ .../multiset/modifiers/erase/51142.cc | 38 +++++ .../23_containers/multiset/modifiers/insert/1.cc | 64 ++++++++ .../23_containers/multiset/modifiers/insert/2.cc | 83 +++++++++++ .../multiset/modifiers/insert/22102.cc | 140 +++++++++++++++++ .../23_containers/multiset/modifiers/insert/3.cc | 69 +++++++++ .../23_containers/multiset/modifiers/insert/4.cc | 69 +++++++++ .../23_containers/multiset/modifiers/swap/1.cc | 65 ++++++++ .../23_containers/multiset/modifiers/swap/2.cc | 137 +++++++++++++++++ .../23_containers/multiset/modifiers/swap/3.cc | 166 +++++++++++++++++++++ .../23_containers/multiset/operations/1.cc | 125 ++++++++++++++++ .../23_containers/multiset/range_access.cc | 31 ++++ .../multiset/requirements/citerators.cc | 30 ++++ .../multiset/requirements/exception/basic.cc | 41 +++++ .../exception/generation_prohibited.cc | 35 +++++ .../exception/propagation_consistent.cc | 35 +++++ .../requirements/explicit_instantiation/1.cc | 25 ++++ .../requirements/explicit_instantiation/1_c++0x.cc | 25 ++++ .../requirements/explicit_instantiation/2.cc | 27 ++++ .../requirements/explicit_instantiation/3.cc | 26 ++++ .../requirements/explicit_instantiation/4.cc | 29 ++++ .../requirements/partial_specialization/1.cc | 33 ++++ .../multiset/requirements/typedefs.cc | 25 ++++ 38 files changed, 1987 insertions(+) create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/14340.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/23781_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/cons/moveable.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/construct1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/construct2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/construct3_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/construct4_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/insert1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/insert2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/insert3_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/insert4_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/dr130.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/init-list.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/51142.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/22102.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/4.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/operations/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/basic.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/generation_prohibited.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/propagation_consistent.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/1_c++0x.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/4.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/partial_specialization/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/typedefs.cc (limited to 'libstdc++-v3/testsuite/23_containers/multiset') diff --git a/libstdc++-v3/testsuite/23_containers/multiset/14340.cc b/libstdc++-v3/testsuite/23_containers/multiset/14340.cc new file mode 100644 index 000000000..cbc29e914 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/14340.cc @@ -0,0 +1,34 @@ +// -*- C++ -*- + +// Copyright (C) 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 +// 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 + +// NB: This issue affected only debug-mode. + +// { dg-do compile } + +// libstdc++/14340 +int main() +{ + typedef std::multiset container; + __gnu_test::conversion::iterator_to_const_iterator(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/23781_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/23781_neg.cc new file mode 100644 index 000000000..6b0bacf95 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/23781_neg.cc @@ -0,0 +1,28 @@ +// 2005-09-10 Paolo Carlini +// +// Copyright (C) 2005, 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 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 +// . +// + +// { dg-do compile } + +// libstdc++/23781 +#include +#include + +std::multiset::iterator it = NULL; // { dg-error "conversion" } +std::multiset::const_iterator cit = NULL; // { dg-error "conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc new file mode 100644 index 000000000..0a05f83c5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc @@ -0,0 +1,38 @@ +// Copyright (C) 2006, 2007, 2008, 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 +// . + +// 23.3.4 multiset capacity + +#include +#include + +// libstdc++/29134 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::multiset ms; + + VERIFY( ms.max_size() + == std::allocator >().max_size() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/multiset/cons/moveable.cc new file mode 100644 index 000000000..527e66e95 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/cons/moveable.cc @@ -0,0 +1,43 @@ +// { 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 multiset (via swap). If the implementation changed +// this test may begin to fail. + +#include +#include +#include + +int main() +{ + bool test __attribute__((unused)) = true; + + std::multiset a,b; + a.insert(2); + b.insert(1); + b = std::move(a); + VERIFY(b.find(2) != b.end() && a.find(1) == a.end()); + + std::multiset c(std::move(b)); + VERIFY( c.find(2) != c.end()); + VERIFY( b.find(2) == b.end()); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/construct1_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct1_neg.cc new file mode 100644 index 000000000..04b0e33f9 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct1_neg.cc @@ -0,0 +1,33 @@ +// 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_construct1 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/construct2_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct2_neg.cc new file mode 100644 index 000000000..d7dd965d3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct2_neg.cc @@ -0,0 +1,33 @@ +// 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_construct2 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/construct3_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct3_neg.cc new file mode 100644 index 000000000..cc3e1471d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct3_neg.cc @@ -0,0 +1,33 @@ +// 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_construct3 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct4_neg.cc new file mode 100644 index 000000000..181f4f902 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct4_neg.cc @@ -0,0 +1,32 @@ +// 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 +// . +// +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_construct1<__gnu_debug::multiset >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/insert1_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert1_neg.cc new file mode 100644 index 000000000..32f20a90b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert1_neg.cc @@ -0,0 +1,33 @@ +// 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_insert1 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/insert2_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert2_neg.cc new file mode 100644 index 000000000..699f0dd47 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert2_neg.cc @@ -0,0 +1,33 @@ +// 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_insert2 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/insert3_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert3_neg.cc new file mode 100644 index 000000000..92f864d60 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert3_neg.cc @@ -0,0 +1,33 @@ +// 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 +// . +// +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_insert3 >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert4_neg.cc new file mode 100644 index 000000000..a0881075f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert4_neg.cc @@ -0,0 +1,32 @@ +// 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 +// . +// +// { dg-do run { xfail *-*-* } } + +#include +#include + +void test01() +{ + __gnu_test::check_insert1<__gnu_debug::multiset >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/1.cc new file mode 100644 index 000000000..5b81b1eea --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/1.cc @@ -0,0 +1,51 @@ +// Multiset iterator invalidation tests + +// Copyright (C) 2003, 2004, 2005, 2006, 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 + +using __gnu_debug::multiset; +using std::advance; + +bool test = true; + +// Assignment +void test01() +{ + multiset v1; + multiset v2; + + v1.insert(17); + + multiset::iterator start = v1.begin(); + multiset::iterator finish = v1.end(); + VERIFY(start._M_dereferenceable()); + VERIFY(!finish._M_dereferenceable() && !finish._M_singular()); + + v1 = v2; + VERIFY(start._M_singular()); + VERIFY(!finish._M_dereferenceable() && !finish._M_singular()); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/2.cc new file mode 100644 index 000000000..be4eeb42d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/2.cc @@ -0,0 +1,69 @@ +// Multiset iterator invalidation tests + +// Copyright (C) 2003, 2004, 2005, 2006, 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 + +using __gnu_debug::multiset; +using std::advance; + +// Erase +void test02() +{ + bool test __attribute__((unused)) = true; + multiset v; + for (int i = 0; i < 20; ++i) + v.insert(i); + + // Single element erase (middle) + multiset::iterator before = v.begin(); + multiset::iterator at = before; + advance(at, 3); + multiset::iterator after = at; + ++after; + v.erase(at); + VERIFY(before._M_dereferenceable()); + VERIFY(at._M_singular()); + VERIFY(after._M_dereferenceable()); + + // Multiple element erase + before = v.begin(); + at = before; + advance(at, 3); + after = at; + advance(after, 4); + v.erase(at, after); + VERIFY(before._M_dereferenceable()); + VERIFY(at._M_singular()); + + // clear() + before = v.begin(); + multiset::iterator finish = v.end(); + VERIFY(before._M_dereferenceable()); + v.clear(); + VERIFY(before._M_singular()); + VERIFY(!finish._M_singular() && !finish._M_dereferenceable()); +} + +int main() +{ + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/dr130.cc b/libstdc++-v3/testsuite/23_containers/multiset/dr130.cc new file mode 100644 index 000000000..52392fcc1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/dr130.cc @@ -0,0 +1,85 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on multiset (via swap). If the implementation changed +// this test may begin to fail. + +#include +#include +#include + +using namespace std; + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + multiset ms0; + typedef multiset::iterator iterator; + typedef multiset::const_iterator const_iterator; + typedef iterator insert_return_type; + + vector irt; + for ( int i = 1; i <= 4; ++i ) + for (int j = 1; j <= i; ++j) + irt.push_back( ms0.insert( i ) ); + + iterator pos1 = ms0.erase(irt[1]); + VERIFY( pos1 == irt[2] ); + + iterator pos2 = ms0.erase(irt[2]); + VERIFY( pos2 == irt[3] ); + + iterator pos3 = ms0.erase(irt[9]); + VERIFY( pos3 == ms0.end() ); +} + +void +test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + multiset ms0; + typedef multiset::iterator iterator; + typedef multiset::const_iterator const_iterator; + typedef iterator insert_return_type; + + vector irt; + for ( int i = 1; i <= 4; ++i ) + for (int j = 1; j <= i; ++j) + irt.push_back( ms0.insert( i ) ); + + iterator pos1 = ms0.erase(irt[3], irt[6]); + VERIFY( pos1 == irt[6] ); + + iterator pos2 = ms0.erase(irt[6], ++irt[9]); + VERIFY( pos2 == ms0.end() ); +} + +int +main() +{ + test01(); + test02(); +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/init-list.cc b/libstdc++-v3/testsuite/23_containers/multiset/init-list.cc new file mode 100644 index 000000000..a8721db99 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/init-list.cc @@ -0,0 +1,59 @@ +// Copyright (C) 2008, 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 +// . +// + +// { dg-options "-std=gnu++0x" } + +#include +#include + +using namespace std; + +int test01() +{ + bool test __attribute__((unused)) = true; + + multiset m({ 1, 5, 5, 37 }); + VERIFY(m.size() == 4); + VERIFY(m.count(1) == 1); + VERIFY(m.count(5) == 2); + VERIFY(m.count(37) == 1); + VERIFY(m.count(42) == 0); + + m = { 28, 37, 37, 37, 102 }; + VERIFY(m.size() == 5); + VERIFY(m.count(28) == 1); + VERIFY(m.count(37) == 3); + VERIFY(m.count(102) == 1); + VERIFY(m.count(1) == 0); + + m.insert({ 42, 42 }); + VERIFY(m.size() == 7); + VERIFY(m.count(28) == 1); + VERIFY(m.count(37) == 3); + VERIFY(m.count(102) == 1); + VERIFY(m.count(42) == 2); + VERIFY(m.count(1) == 0); + + return test; +} + +int main() +{ + __gnu_test::set_memory_limits(); + test01(); +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/51142.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/51142.cc new file mode 100644 index 000000000..c5beb6a8d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/51142.cc @@ -0,0 +1,38 @@ +// Copyright (C) 2011 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 +// . +// + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include + +struct X +{ + template + X(T&) {} +}; + +bool operator<(const X&, const X&) { return false; } + +// LWG 2059. +void erasor(std::multiset& s, X x) +{ + std::multiset::iterator it = s.find(x); + if (it != s.end()) + s.erase(it); +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/1.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/1.cc new file mode 100644 index 000000000..87b1d3635 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/1.cc @@ -0,0 +1,64 @@ +// 1999-06-24 bkoz + +// Copyright (C) 1999, 2004, 2005, 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 +// . + +// 23.3.4 template class multiset + +#include +#include +#include +#include +#include + +namespace std +{ + std::ostream& + operator<<(std::ostream& os, std::pair const& p) + { return os << p.first << ' ' << p.second; } +} + +bool +operator<(std::pair const& lhs, std::pair const& rhs) +{ return lhs.first < rhs.first; } + +int main () +{ + bool test __attribute__((unused)) = true; + typedef std::multiset >::iterator iterator; + std::pair p(69, 0); + std::multiset > s; + + for (p.second = 0; p.second < 5; ++p.second) + s.insert(p); + for (iterator it = s.begin(); it != s.end(); ++it) + if (it->second < 5) + { + s.insert(it, p); + ++p.second; + } + + std::ostringstream stream; + std::copy(s.begin(), s.end(), + std::ostream_iterator >(stream, "\n")); + const std::string expected("69 0\n69 1\n69 2\n69 3\n69 4\n" + "69 5\n69 6\n69 7\n69 8\n69 9\n"); + std::string tested(stream.str()); + VERIFY( tested == expected ); + + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/2.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/2.cc new file mode 100644 index 000000000..dcd3bd0b7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/2.cc @@ -0,0 +1,83 @@ +// 2005-01-17 Paolo Carlini + +// Copyright (C) 2005, 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 + +// A few tests for insert with hint, in the occasion of libstdc++/19422 +// and libstdc++/19433. +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + multiset ms0, ms1; + multiset::iterator iter1; + + ms0.insert(1); + ms1.insert(ms1.end(), 1); + VERIFY( ms0 == ms1 ); + + ms0.insert(3); + ms1.insert(ms1.begin(), 3); + VERIFY( ms0 == ms1 ); + + ms0.insert(4); + iter1 = ms1.insert(ms1.end(), 4); + VERIFY( ms0 == ms1 ); + + ms0.insert(6); + ms1.insert(iter1, 6); + VERIFY( ms0 == ms1 ); + + ms0.insert(2); + ms1.insert(ms1.begin(), 2); + VERIFY( ms0 == ms1 ); + + ms0.insert(7); + ms1.insert(ms1.end(), 7); + VERIFY( ms0 == ms1 ); + + ms0.insert(5); + ms1.insert(ms1.find(4), 5); + VERIFY( ms0 == ms1 ); + + ms0.insert(0); + ms1.insert(ms1.end(), 0); + VERIFY( ms0 == ms1 ); + + ms0.insert(8); + ms1.insert(ms1.find(3), 8); + VERIFY( ms0 == ms1 ); + + ms0.insert(9); + ms1.insert(ms1.end(), 9); + VERIFY( ms0 == ms1 ); + + ms0.insert(10); + ms1.insert(ms1.begin(), 10); + VERIFY( ms0 == ms1 ); +} + +int main () +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/22102.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/22102.cc new file mode 100644 index 000000000..3e6d92602 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/22102.cc @@ -0,0 +1,140 @@ +// 2006-01-07 Paolo Carlini + +// Copyright (C) 2006, 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 +// . + +// 23.3.4 Class template multiset + +#include +#include + +// libstdc++/22102 +void test01() +{ + bool test __attribute__((unused)) = true; + typedef std::multiset Mset; + typedef Mset::value_type value_type; + typedef Mset::iterator iterator; + + Mset ms1; + + const iterator it1 = ms1.insert(value_type(0)); + const iterator it2 = ms1.insert(value_type(1)); + const iterator it3 = ms1.insert(value_type(2)); + + const value_type vt1(2); + const iterator it4 = ms1.insert(it1, vt1); + iterator it5 = it4; + iterator it6 = it4; + VERIFY( ms1.size() == 4 ); + VERIFY( *it4 == vt1 ); + VERIFY( ++it5 == it3 ); + VERIFY( --it6 == it2 ); + VERIFY( *it5 == *it3 ); + VERIFY( *it6 == *it2 ); + + const value_type vt2(2); + const iterator it7 = ms1.insert(ms1.begin(), vt2); + iterator it8 = it7; + iterator it9 = it7; + VERIFY( ms1.size() == 5 ); + VERIFY( *it7 == vt2 ); + VERIFY( ++it8 == it4 ); + VERIFY( --it9 == it2 ); + VERIFY( *it8 == *it4 ); + VERIFY( *it9 == *it2 ); + + const value_type vt3(2); + const iterator it10 = ms1.insert(it1, vt3); + iterator it11 = it10; + iterator it12 = it10; + VERIFY( ms1.size() == 6 ); + VERIFY( *it10 == vt3 ); + VERIFY( ++it11 == it7 ); + VERIFY( --it12 == it2 ); + VERIFY( *it11 == *it7 ); + VERIFY( *it12 == *it2 ); + + const value_type vt4(0); + const iterator it13 = ms1.insert(it10, vt4); + iterator it14 = it13; + iterator it15 = it13; + VERIFY( ms1.size() == 7 ); + VERIFY( *it13 == vt4 ); + VERIFY( ++it14 == it2 ); + VERIFY( --it15 == it1 ); + VERIFY( *it14 == *it2 ); + VERIFY( *it15 == *it1 ); + + const value_type vt5(1); + const iterator it16 = ms1.insert(it13, vt5); + iterator it17 = it16; + iterator it18 = it16; + VERIFY( ms1.size() == 8 ); + VERIFY( *it16 == vt5 ); + VERIFY( ++it17 == it2 ); + VERIFY( --it18 == it13 ); + VERIFY( *it17 == *it2 ); + VERIFY( *it18 == *it13 ); + + const value_type vt6(0); + const iterator it19 = ms1.insert(it1, vt6); + iterator it20 = it19; + VERIFY( ms1.size() == 9 ); + VERIFY( *it19 == vt6 ); + VERIFY( it19 == ms1.begin() ); + VERIFY( ++it20 == it1 ); + VERIFY( *it20 == *it1 ); + + const value_type vt7(3); + const iterator it21 = ms1.insert(it19, vt7); + iterator it22 = it21; + iterator it23 = it21; + VERIFY( ms1.size() == 10 ); + VERIFY( *it21 == vt7 ); + VERIFY( ++it22 == ms1.end() ); + VERIFY( --it23 == it3 ); + VERIFY( *it23 == *it3 ); + + const value_type vt8(2); + const iterator it24 = ms1.insert(ms1.end(), vt8); + iterator it25 = it24; + iterator it26 = it24; + VERIFY( ms1.size() == 11 ); + VERIFY( *it24 == vt8 ); + VERIFY( ++it25 == it21 ); + VERIFY( --it26 == it3 ); + VERIFY( *it25 == *it21 ); + VERIFY( *it26 == *it3 ); + + const value_type vt9(3); + const iterator it27 = ms1.insert(it3, vt9); + iterator it28 = it27; + iterator it29 = it27; + VERIFY( ms1.size() == 12 ); + VERIFY( *it27 == vt9 ); + VERIFY( ++it28 == it21 ); + VERIFY( --it29 == it24 ); + VERIFY( *it28 == *it21 ); + VERIFY( *it29 == *it24 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/3.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/3.cc new file mode 100644 index 000000000..202d2eec0 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/3.cc @@ -0,0 +1,69 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-11-10 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 +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::multiset Set; + Set s; + VERIFY( s.empty() ); + + Set::iterator i = s.insert(rvalstruct(1)); + VERIFY( s.size() == 1 ); + VERIFY( std::distance(s.begin(), s.end()) == 1 ); + VERIFY( i == s.begin() ); + VERIFY( (*i).val == 1 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::multiset Set; + Set s; + VERIFY( s.empty() ); + + s.insert(rvalstruct(2)); + Set::iterator i = s.insert(rvalstruct(2)); + VERIFY( s.size() == 2 ); + VERIFY( std::distance(s.begin(), s.end()) == 2 ); + VERIFY( (*i).val == 2 ); + + Set::iterator i2 = s.begin(); + ++i2; + VERIFY( i == s.begin() || i == i2 ); + VERIFY( (*(s.begin())).val == 2 && (*i2).val == 2 ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/4.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/4.cc new file mode 100644 index 000000000..eccf18f47 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/insert/4.cc @@ -0,0 +1,69 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-11-10 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 +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::multiset Set; + Set s; + VERIFY( s.empty() ); + + Set::iterator i = s.insert(s.begin(), rvalstruct(1)); + VERIFY( s.size() == 1 ); + VERIFY( std::distance(s.begin(), s.end()) == 1 ); + VERIFY( i == s.begin() ); + VERIFY( (*i).val == 1 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::multiset Set; + Set s; + VERIFY( s.empty() ); + + Set::iterator i0 = s.insert(s.begin(), rvalstruct(2)); + Set::iterator i1 = s.insert(i0, rvalstruct(2)); + VERIFY( s.size() == 2 ); + VERIFY( std::distance(s.begin(), s.end()) == 2 ); + VERIFY( (*i1).val == 2 ); + + Set::iterator i2 = s.begin(); + ++i2; + VERIFY( i1 == s.begin() ); + VERIFY( (*(s.begin())).val == 2 && (*i2).val == 2 ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/1.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/1.cc new file mode 100644 index 000000000..f7d541deb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/1.cc @@ -0,0 +1,65 @@ +// Copyright (C) 2004, 2005, 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +struct T { int i; }; + +// T must be LessThanComparable to pass concept-checks +bool operator<(T l, T r) { return l.i < r.i; } + +int swap_calls; + +namespace std +{ + template<> + void + multiset::swap(multiset&) + { ++swap_calls; } +} + +// Should use multiset specialization for swap. +void test01() +{ + bool test __attribute__((unused)) = true; + std::multiset A; + std::multiset B; + swap_calls = 0; + std::swap(A, B); + VERIFY(1 == swap_calls); +} + +// Should use multiset specialization for swap. +void test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + multiset A; + multiset B; + swap_calls = 0; + swap(A, B); + VERIFY(1 == swap_calls); +} + +// See c++/13658 for background info. +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/2.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/2.cc new file mode 100644 index 000000000..81cad5ba5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/2.cc @@ -0,0 +1,137 @@ +// 2005-12-20 Paolo Carlini + +// Copyright (C) 2005, 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 +// . + +// 23.3.4 multiset::swap + +#include +#include +#include + +// uneq_allocator as a non-empty allocator. +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + typedef __gnu_test::uneq_allocator my_alloc; + typedef multiset, my_alloc> my_multiset; + + const char title01[] = "Rivers of sand"; + const char title02[] = "Concret PH"; + const char title03[] = "Sonatas and Interludes for Prepared Piano"; + const char title04[] = "never as tired as when i'm waking up"; + + const size_t N1 = sizeof(title01); + const size_t N2 = sizeof(title02); + const size_t N3 = sizeof(title03); + const size_t N4 = sizeof(title04); + + const multiset mset01_ref(title01, title01 + N1); + const multiset mset02_ref(title02, title02 + N2); + const multiset mset03_ref(title03, title03 + N3); + const multiset mset04_ref(title04, title04 + N4); + + my_multiset::size_type size01, size02; + + my_alloc alloc01(1); + + my_multiset mset01(less(), alloc01); + size01 = mset01.size(); + my_multiset mset02(less(), alloc01); + size02 = mset02.size(); + + mset01.swap(mset02); + VERIFY( mset01.size() == size02 ); + VERIFY( mset01.empty() ); + VERIFY( mset02.size() == size01 ); + VERIFY( mset02.empty() ); + + my_multiset mset03(less(), alloc01); + size01 = mset03.size(); + my_multiset mset04(title02, title02 + N2, less(), alloc01); + size02 = mset04.size(); + + mset03.swap(mset04); + VERIFY( mset03.size() == size02 ); + VERIFY( equal(mset03.begin(), mset03.end(), mset02_ref.begin()) ); + VERIFY( mset04.size() == size01 ); + VERIFY( mset04.empty() ); + + my_multiset mset05(title01, title01 + N1, less(), alloc01); + size01 = mset05.size(); + my_multiset mset06(title02, title02 + N2, less(), alloc01); + size02 = mset06.size(); + + mset05.swap(mset06); + VERIFY( mset05.size() == size02 ); + VERIFY( equal(mset05.begin(), mset05.end(), mset02_ref.begin()) ); + VERIFY( mset06.size() == size01 ); + VERIFY( equal(mset06.begin(), mset06.end(), mset01_ref.begin()) ); + + my_multiset mset07(title01, title01 + N1, less(), alloc01); + size01 = mset07.size(); + my_multiset mset08(title03, title03 + N3, less(), alloc01); + size02 = mset08.size(); + + mset07.swap(mset08); + VERIFY( mset07.size() == size02 ); + VERIFY( equal(mset07.begin(), mset07.end(), mset03_ref.begin()) ); + VERIFY( mset08.size() == size01 ); + VERIFY( equal(mset08.begin(), mset08.end(), mset01_ref.begin()) ); + + my_multiset mset09(title03, title03 + N3, less(), alloc01); + size01 = mset09.size(); + my_multiset mset10(title04, title04 + N4, less(), alloc01); + size02 = mset10.size(); + + mset09.swap(mset10); + VERIFY( mset09.size() == size02 ); + VERIFY( equal(mset09.begin(), mset09.end(), mset04_ref.begin()) ); + VERIFY( mset10.size() == size01 ); + VERIFY( equal(mset10.begin(), mset10.end(), mset03_ref.begin()) ); + + my_multiset mset11(title04, title04 + N4, less(), alloc01); + size01 = mset11.size(); + my_multiset mset12(title01, title01 + N1, less(), alloc01); + size02 = mset12.size(); + + mset11.swap(mset12); + VERIFY( mset11.size() == size02 ); + VERIFY( equal(mset11.begin(), mset11.end(), mset01_ref.begin()) ); + VERIFY( mset12.size() == size01 ); + VERIFY( equal(mset12.begin(), mset12.end(), mset04_ref.begin()) ); + + my_multiset mset13(title03, title03 + N3, less(), alloc01); + size01 = mset13.size(); + my_multiset mset14(title03, title03 + N3, less(), alloc01); + size02 = mset14.size(); + + mset13.swap(mset14); + VERIFY( mset13.size() == size02 ); + VERIFY( equal(mset13.begin(), mset13.end(), mset03_ref.begin()) ); + VERIFY( mset14.size() == size01 ); + VERIFY( equal(mset14.begin(), mset14.end(), mset03_ref.begin()) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/3.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/3.cc new file mode 100644 index 000000000..0d99bfb42 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap/3.cc @@ -0,0 +1,166 @@ +// 2005-12-20 Paolo Carlini + +// Copyright (C) 2005, 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 +// . + +// 23.3.4 multiset::swap + +#include +#include +#include + +// uneq_allocator, two different personalities. +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + typedef __gnu_test::uneq_allocator my_alloc; + typedef multiset, my_alloc> my_multiset; + + const char title01[] = "Rivers of sand"; + const char title02[] = "Concret PH"; + const char title03[] = "Sonatas and Interludes for Prepared Piano"; + const char title04[] = "never as tired as when i'm waking up"; + + const size_t N1 = sizeof(title01); + const size_t N2 = sizeof(title02); + const size_t N3 = sizeof(title03); + const size_t N4 = sizeof(title04); + + const multiset mset01_ref(title01, title01 + N1); + const multiset mset02_ref(title02, title02 + N2); + const multiset mset03_ref(title03, title03 + N3); + const multiset mset04_ref(title04, title04 + N4); + + my_multiset::size_type size01, size02; + + my_alloc alloc01(1), alloc02(2); + int personality01, personality02; + + my_multiset mset01(less(), alloc01); + size01 = mset01.size(); + personality01 = mset01.get_allocator().get_personality(); + my_multiset mset02(less(), alloc02); + size02 = mset02.size(); + personality02 = mset02.get_allocator().get_personality(); + + mset01.swap(mset02); + VERIFY( mset01.size() == size02 ); + VERIFY( mset01.empty() ); + VERIFY( mset02.size() == size01 ); + VERIFY( mset02.empty() ); + VERIFY( mset01.get_allocator().get_personality() == personality02 ); + VERIFY( mset02.get_allocator().get_personality() == personality01 ); + + my_multiset mset03(less(), alloc02); + size01 = mset03.size(); + personality01 = mset03.get_allocator().get_personality(); + my_multiset mset04(title02, title02 + N2, less(), alloc01); + size02 = mset04.size(); + personality02 = mset04.get_allocator().get_personality(); + + mset03.swap(mset04); + VERIFY( mset03.size() == size02 ); + VERIFY( equal(mset03.begin(), mset03.end(), mset02_ref.begin()) ); + VERIFY( mset04.size() == size01 ); + VERIFY( mset04.empty() ); + VERIFY( mset03.get_allocator().get_personality() == personality02 ); + VERIFY( mset04.get_allocator().get_personality() == personality01 ); + + my_multiset mset05(title01, title01 + N1, less(), alloc01); + size01 = mset05.size(); + personality01 = mset05.get_allocator().get_personality(); + my_multiset mset06(title02, title02 + N2, less(), alloc02); + size02 = mset06.size(); + personality02 = mset06.get_allocator().get_personality(); + + mset05.swap(mset06); + VERIFY( mset05.size() == size02 ); + VERIFY( equal(mset05.begin(), mset05.end(), mset02_ref.begin()) ); + VERIFY( mset06.size() == size01 ); + VERIFY( equal(mset06.begin(), mset06.end(), mset01_ref.begin()) ); + VERIFY( mset05.get_allocator().get_personality() == personality02 ); + VERIFY( mset06.get_allocator().get_personality() == personality01 ); + + my_multiset mset07(title01, title01 + N1, less(), alloc02); + size01 = mset07.size(); + personality01 = mset07.get_allocator().get_personality(); + my_multiset mset08(title03, title03 + N3, less(), alloc01); + size02 = mset08.size(); + personality02 = mset08.get_allocator().get_personality(); + + mset07.swap(mset08); + VERIFY( mset07.size() == size02 ); + VERIFY( equal(mset07.begin(), mset07.end(), mset03_ref.begin()) ); + VERIFY( mset08.size() == size01 ); + VERIFY( equal(mset08.begin(), mset08.end(), mset01_ref.begin()) ); + VERIFY( mset07.get_allocator().get_personality() == personality02 ); + VERIFY( mset08.get_allocator().get_personality() == personality01 ); + + my_multiset mset09(title03, title03 + N3, less(), alloc01); + size01 = mset09.size(); + personality01 = mset09.get_allocator().get_personality(); + my_multiset mset10(title04, title04 + N4, less(), alloc02); + size02 = mset10.size(); + personality02 = mset10.get_allocator().get_personality(); + + mset09.swap(mset10); + VERIFY( mset09.size() == size02 ); + VERIFY( equal(mset09.begin(), mset09.end(), mset04_ref.begin()) ); + VERIFY( mset10.size() == size01 ); + VERIFY( equal(mset10.begin(), mset10.end(), mset03_ref.begin()) ); + VERIFY( mset09.get_allocator().get_personality() == personality02 ); + VERIFY( mset10.get_allocator().get_personality() == personality01 ); + + my_multiset mset11(title04, title04 + N4, less(), alloc02); + size01 = mset11.size(); + personality01 = mset11.get_allocator().get_personality(); + my_multiset mset12(title01, title01 + N1, less(), alloc01); + size02 = mset12.size(); + personality02 = mset12.get_allocator().get_personality(); + + mset11.swap(mset12); + VERIFY( mset11.size() == size02 ); + VERIFY( equal(mset11.begin(), mset11.end(), mset01_ref.begin()) ); + VERIFY( mset12.size() == size01 ); + VERIFY( equal(mset12.begin(), mset12.end(), mset04_ref.begin()) ); + VERIFY( mset11.get_allocator().get_personality() == personality02 ); + VERIFY( mset12.get_allocator().get_personality() == personality01 ); + + my_multiset mset13(title03, title03 + N3, less(), alloc01); + size01 = mset13.size(); + personality01 = mset13.get_allocator().get_personality(); + my_multiset mset14(title03, title03 + N3, less(), alloc02); + size02 = mset14.size(); + personality02 = mset14.get_allocator().get_personality(); + + mset13.swap(mset14); + VERIFY( mset13.size() == size02 ); + VERIFY( equal(mset13.begin(), mset13.end(), mset03_ref.begin()) ); + VERIFY( mset14.size() == size01 ); + VERIFY( equal(mset14.begin(), mset14.end(), mset03_ref.begin()) ); + VERIFY( mset13.get_allocator().get_personality() == personality02 ); + VERIFY( mset14.get_allocator().get_personality() == personality01 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/operations/1.cc b/libstdc++-v3/testsuite/23_containers/multiset/operations/1.cc new file mode 100644 index 000000000..a54795d65 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/operations/1.cc @@ -0,0 +1,125 @@ +// 2006-11-25 Paolo Carlini + +// Copyright (C) 2006, 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 + +// A few tests for equal_range, in the occasion of libstdc++/29385. +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + multiset ms0; + typedef multiset::iterator iterator; + pair pp0; + + pp0 = ms0.equal_range(1); + VERIFY( ms0.count(1) == 0 ); + VERIFY( pp0.first == ms0.end() ); + VERIFY( pp0.second == ms0.end() ); + + iterator iter0 = ms0.insert(1); + iterator iter1 = ms0.insert(2); + iterator iter2 = ms0.insert(3); + + pp0 = ms0.equal_range(2); + VERIFY( ms0.count(2) == 1 ); + VERIFY( *pp0.first == 2 ); + VERIFY( *pp0.second == 3 ); + VERIFY( pp0.first == iter1 ); + VERIFY( --pp0.first == iter0 ); + VERIFY( pp0.second == iter2 ); + + ms0.insert(3); + iterator iter3 = ms0.insert(3); + iterator iter4 = ms0.insert(4); + + pp0 = ms0.equal_range(3); + VERIFY( ms0.count(3) == 3 ); + VERIFY( *pp0.first == 3 ); + VERIFY( *pp0.second == 4 ); + VERIFY( pp0.first == iter2 ); + VERIFY( --pp0.first == iter1 ); + VERIFY( pp0.second == iter4 ); + + iterator iter5 = ms0.insert(0); + ms0.insert(1); + ms0.insert(1); + ms0.insert(1); + + pp0 = ms0.equal_range(1); + VERIFY( ms0.count(1) == 4 ); + VERIFY( *pp0.first == 1 ); + VERIFY( *pp0.second == 2 ); + VERIFY( pp0.first == iter0 ); + VERIFY( --pp0.first == iter5 ); + VERIFY( pp0.second == iter1 ); + + iterator iter6 = ms0.insert(5); + ms0.insert(5); + ms0.insert(5); + + pp0 = ms0.equal_range(5); + VERIFY( ms0.count(5) == 3 ); + VERIFY( *pp0.first == 5 ); + VERIFY( pp0.first == iter6 ); + VERIFY( --pp0.first == iter4 ); + VERIFY( pp0.second == ms0.end() ); + + ms0.insert(4); + ms0.insert(4); + ms0.insert(4); + + pp0 = ms0.equal_range(4); + VERIFY( ms0.count(4) == 4 ); + VERIFY( *pp0.first == 4 ); + VERIFY( *pp0.second == 5 ); + VERIFY( pp0.first == iter4 ); + VERIFY( --pp0.first == iter3 ); + VERIFY( pp0.second == iter6 ); + + ms0.insert(0); + iterator iter7 = ms0.insert(0); + ms0.insert(1); + + pp0 = ms0.equal_range(0); + VERIFY( ms0.count(0) == 3 ); + VERIFY( *pp0.first == 0 ); + VERIFY( *pp0.second == 1 ); + VERIFY( pp0.first == iter5 ); + VERIFY( pp0.first == ms0.begin() ); + VERIFY( pp0.second == iter0 ); + + pp0 = ms0.equal_range(1); + VERIFY( ms0.count(1) == 5 ); + VERIFY( *pp0.first == 1 ); + VERIFY( *pp0.second == 2 ); + VERIFY( pp0.first == iter0 ); + VERIFY( --pp0.first == iter7 ); + VERIFY( pp0.second == iter1 ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/range_access.cc b/libstdc++-v3/testsuite/23_containers/multiset/range_access.cc new file mode 100644 index 000000000..d3fb95ea2 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/range_access.cc @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::multiset ms{1, 2, 3}; + std::begin(ms); + std::end(ms); +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc new file mode 100644 index 000000000..bf3aa1644 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc @@ -0,0 +1,30 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 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 + +int main() +{ + typedef std::multiset test_type; + __gnu_test::citerator test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/basic.cc new file mode 100644 index 000000000..4525843e1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/basic.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// 2009-11-30 Benjamin Kosnik + +// 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 +// . + +#include +#include + +void +value() +{ + typedef __gnu_cxx::throw_value_limit value_type; + typedef __gnu_cxx::throw_allocator_limit allocator_type; + typedef std::less compare_type; + typedef std::multiset test_type; + __gnu_test::basic_safety test; +} + +// Container requirement testing, exceptional behavior +int main() +{ + value(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/generation_prohibited.cc new file mode 100644 index 000000000..889b1067b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/generation_prohibited.cc @@ -0,0 +1,35 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// 2009-09-09 Benjamin Kosnik + +// 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 +// . + +#include +#include + +// Container requirement testing, exceptional behavior +int main() +{ + typedef __gnu_cxx::throw_value_random value_type; + typedef __gnu_cxx::throw_allocator_random allocator_type; + typedef std::less compare_type; + typedef std::multiset test_type; + __gnu_test::generation_prohibited test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/propagation_consistent.cc new file mode 100644 index 000000000..b1dd057eb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/exception/propagation_consistent.cc @@ -0,0 +1,35 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// 2009-09-09 Benjamin Kosnik + +// 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 +// . + +#include +#include + +// Container requirement testing, exceptional behavior +int main() +{ + typedef __gnu_cxx::throw_value_limit value_type; + typedef __gnu_cxx::throw_allocator_limit allocator_type; + typedef std::less compare_type; + typedef std::multiset test_type; + __gnu_test::propagation_consistent test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/1.cc new file mode 100644 index 000000000..cdc8db7c8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/1.cc @@ -0,0 +1,25 @@ +// Copyright (C) 2004, 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 +// . + + +// This file tests explicit instantiation of library containers + +#include + +// { dg-do compile } + +template class std::multiset; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/1_c++0x.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/1_c++0x.cc new file mode 100644 index 000000000..cb522b2e5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/1_c++0x.cc @@ -0,0 +1,25 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// 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 +// . + +// This file tests explicit instantiation of library containers + +#include + +template class std::multiset; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..11f29c028 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/2.cc @@ -0,0 +1,27 @@ +// Copyright (C) 2004, 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 +// . + + +// This file tests explicit instantiation of library containers + +#include +#include +#include + +// { dg-do compile } + +template class std::multiset<__gnu_test::NonDefaultConstructible>; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/3.cc new file mode 100644 index 000000000..7f6b64040 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/3.cc @@ -0,0 +1,26 @@ +// Copyright (C) 2005, 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 +// . + + +// This file tests explicit instantiation of library containers + +#include + +// { dg-do compile } + +// libstdc++/21770 +template class std::multiset, std::allocator >; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/4.cc new file mode 100644 index 000000000..d55064cd1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/4.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2010 Free Software Foundation, Inc. + +// 2010-05-20 Paolo Carlini +// +// 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include +#include + +// { dg-do compile } + +// libstdc++/41792 +template class std::multiset<__gnu_test::OverloadedAddress>; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/partial_specialization/1.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/partial_specialization/1.cc new file mode 100644 index 000000000..959d4a848 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/partial_specialization/1.cc @@ -0,0 +1,33 @@ +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 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 +// . + + +// This file tests user specialization of library containers + +#include +#include + +// { dg-do compile } + +struct user_type {}; + +namespace std +{ + template + class multiset {}; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/typedefs.cc new file mode 100644 index 000000000..7244003c2 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/typedefs.cc @@ -0,0 +1,25 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// 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 +// . + +#include +#include + +// Check container for required typedefs. +__gnu_test::types > t; -- cgit v1.2.3