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. --- libstdc++-v3/testsuite/23_containers/set/14340.cc | 34 +++++ libstdc++-v3/testsuite/23_containers/set/18604.cc | 43 ++++++ .../testsuite/23_containers/set/23781_neg.cc | 28 ++++ .../testsuite/23_containers/set/capacity/29134.cc | 38 +++++ .../23_containers/set/check_construct_destroy.cc | 76 ++++++++++ .../testsuite/23_containers/set/cons/moveable.cc | 43 ++++++ .../23_containers/set/debug/construct1_neg.cc | 33 ++++ .../23_containers/set/debug/construct2_neg.cc | 33 ++++ .../23_containers/set/debug/construct3_neg.cc | 33 ++++ .../23_containers/set/debug/construct4_neg.cc | 32 ++++ .../23_containers/set/debug/insert1_neg.cc | 33 ++++ .../23_containers/set/debug/insert2_neg.cc | 33 ++++ .../23_containers/set/debug/insert3_neg.cc | 33 ++++ .../23_containers/set/debug/insert4_neg.cc | 32 ++++ .../23_containers/set/debug/invalidation/1.cc | 51 +++++++ .../23_containers/set/debug/invalidation/2.cc | 70 +++++++++ libstdc++-v3/testsuite/23_containers/set/dr130.cc | 75 ++++++++++ .../testsuite/23_containers/set/init-list.cc | 59 ++++++++ .../testsuite/23_containers/set/modifiers/16728.cc | 92 ++++++++++++ .../testsuite/23_containers/set/modifiers/17948.cc | 44 ++++++ .../23_containers/set/modifiers/erase/51142.cc | 38 +++++ .../23_containers/set/modifiers/insert/1.cc | 83 +++++++++++ .../23_containers/set/modifiers/insert/2.cc | 67 +++++++++ .../23_containers/set/modifiers/insert/3.cc | 64 ++++++++ .../23_containers/set/modifiers/swap/1.cc | 65 ++++++++ .../23_containers/set/modifiers/swap/2.cc | 137 +++++++++++++++++ .../23_containers/set/modifiers/swap/3.cc | 166 +++++++++++++++++++++ .../testsuite/23_containers/set/operations/1.cc | 126 ++++++++++++++++ .../testsuite/23_containers/set/operators/1_neg.cc | 43 ++++++ .../testsuite/23_containers/set/range_access.cc | 31 ++++ .../23_containers/set/requirements/citerators.cc | 30 ++++ .../set/requirements/exception/basic.cc | 41 +++++ .../exception/generation_prohibited.cc | 35 +++++ .../exception/propagation_consistent.cc | 35 +++++ .../set/requirements/explicit_instantiation/1.cc | 25 ++++ .../requirements/explicit_instantiation/1_c++0x.cc | 25 ++++ .../set/requirements/explicit_instantiation/2.cc | 27 ++++ .../set/requirements/explicit_instantiation/3.cc | 26 ++++ .../set/requirements/explicit_instantiation/4.cc | 29 ++++ .../set/requirements/partial_specialization/1.cc | 33 ++++ .../23_containers/set/requirements/typedefs.cc | 25 ++++ 41 files changed, 2066 insertions(+) create mode 100644 libstdc++-v3/testsuite/23_containers/set/14340.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/18604.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/23781_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/check_construct_destroy.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/cons/moveable.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/construct1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/construct2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/construct3_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/insert1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/insert2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/insert3_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/dr130.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/init-list.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/17948.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/erase/51142.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/insert/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/insert/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/insert/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/swap/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/swap/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/swap/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/operations/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/exception/generation_prohibited.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/exception/propagation_consistent.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1_c++0x.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/partial_specialization/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc (limited to 'libstdc++-v3/testsuite/23_containers/set') diff --git a/libstdc++-v3/testsuite/23_containers/set/14340.cc b/libstdc++-v3/testsuite/23_containers/set/14340.cc new file mode 100644 index 000000000..8539544e6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set container; + __gnu_test::conversion::iterator_to_const_iterator(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/18604.cc b/libstdc++-v3/testsuite/23_containers/set/18604.cc new file mode 100644 index 000000000..a57f95f4b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/18604.cc @@ -0,0 +1,43 @@ +// 2005-05-09 Paolo Carlini + +// Copyright (C) 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 +// . + +// NB: This issue affected only debug-mode. + +// { dg-do compile } + +// libstdc++/18604 +struct less; +struct allocator; +struct pair; +struct binary_function; +struct iterator; +struct iterator_traits; +struct bidirectional_iterator_tag; +struct forward_iterator_tag; +struct input_iterator_tag; +struct random_access_iterator_tag; +struct ios_base; +struct basic_string; +struct basic_istream; +struct basic_ostream; +struct char_traits; + +#include + diff --git a/libstdc++-v3/testsuite/23_containers/set/23781_neg.cc b/libstdc++-v3/testsuite/23_containers/set/23781_neg.cc new file mode 100644 index 000000000..b47b748ec --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set::iterator it = NULL; // { dg-error "conversion" } +std::set::const_iterator cit = NULL; // { dg-error "conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc new file mode 100644 index 000000000..7d9bccd0f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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.3 set capacity + +#include +#include + +// libstdc++/29134 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::set s; + + VERIFY( s.max_size() == + std::allocator >().max_size() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/check_construct_destroy.cc b/libstdc++-v3/testsuite/23_containers/set/check_construct_destroy.cc new file mode 100644 index 000000000..6a9bf611c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/check_construct_destroy.cc @@ -0,0 +1,76 @@ +// 2004-07-26 Matt Austern +// +// Copyright (C) 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 +// . +// + +#include +#include +#include +#include + +using namespace __gnu_test; + +int main() +{ + typedef std::set, tracker_allocator > Container; + const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 }; + const int arr10a[10] = { 31, 23, 82, 46, 13, 17, 30, 71, 22, 51 }; + bool ok = true; + + tracker_allocator_counter::reset(); + { + Container c; + ok = check_construct_destroy("empty container", 0, 0) && ok; + } + ok = check_construct_destroy("empty container", 0, 0) && ok; + + + tracker_allocator_counter::reset(); + { + Container c(arr10, arr10 + 10); + ok = check_construct_destroy("Construct from range", 10, 0) && ok; + } + ok = check_construct_destroy("Construct from range", 10, 10) && ok; + + { + Container c(arr10, arr10 + 10); + tracker_allocator_counter::reset(); + c.insert(arr10a[0]); + ok = check_construct_destroy("Insert element", 1, 0) && ok; + } + ok = check_construct_destroy("Insert element", 1, 11) && ok; + + { + Container c(arr10, arr10 + 10); + tracker_allocator_counter::reset(); + c.insert(arr10a, arr10a+3); + ok = check_construct_destroy("Insert short range", 3, 0) && ok; + } + ok = check_construct_destroy("Insert short range", 3, 13) && ok; + + { + Container c(arr10, arr10 + 10); + tracker_allocator_counter::reset(); + c.insert(arr10a, arr10a+10); + ok = check_construct_destroy("Insert long range", 10, 0) && ok; + } + ok = check_construct_destroy("Insert long range", 10, 20) && ok; + + return ok ? 0 : 1; +} + diff --git a/libstdc++-v3/testsuite/23_containers/set/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/set/cons/moveable.cc new file mode 100644 index 000000000..9c43e3833 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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 set (via swap). If the implementation changed +// this test may begin to fail. + +#include +#include +#include + +int main() +{ + bool test __attribute__((unused)) = true; + + std::set a,b; + a.insert(2); + b.insert(1); + b = std::move(a); + VERIFY(b.find(2) != b.end() && a.find(1) == a.end()); + + std::set 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/set/debug/construct1_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct1_neg.cc new file mode 100644 index 000000000..424eb8be2 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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/set/debug/construct2_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct2_neg.cc new file mode 100644 index 000000000..d5819925b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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/set/debug/construct3_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct3_neg.cc new file mode 100644 index 000000000..1cc7dd234 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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/set/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc new file mode 100644 index 000000000..d464aabfb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/insert1_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/insert1_neg.cc new file mode 100644 index 000000000..3192ff959 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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/set/debug/insert2_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/insert2_neg.cc new file mode 100644 index 000000000..d0d16cfb9 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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/set/debug/insert3_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/insert3_neg.cc new file mode 100644 index 000000000..9eaf6f82b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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/set/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc new file mode 100644 index 000000000..c2424d2a3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set >(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc new file mode 100644 index 000000000..6d5a0f50b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc @@ -0,0 +1,51 @@ +// Set 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::set; +using std::advance; + +bool test = true; + +// Assignment +void test01() +{ + set v1; + set v2; + + v1.insert(17); + + set::iterator start = v1.begin(); + set::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/set/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc new file mode 100644 index 000000000..2539b03dd --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc @@ -0,0 +1,70 @@ +// Set 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::set; +using std::advance; + +// Erase +void test02() +{ + bool test __attribute__((unused)) = true; + + set v; + for (int i = 0; i < 20; ++i) + v.insert(i); + + // Single element erase (middle) + set::iterator before = v.begin(); + set::iterator at = before; + advance(at, 3); + set::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(); + set::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/set/dr130.cc b/libstdc++-v3/testsuite/23_containers/set/dr130.cc new file mode 100644 index 000000000..1dac5628d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/dr130.cc @@ -0,0 +1,75 @@ +// { dg-options "-std=gnu++0x" } +// 2008-07-22 Edward Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms 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 + +// DR 130. Associative erase should return an iterator. +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + set s0; + typedef set::iterator iterator; + typedef set::const_iterator const_iterator; + typedef pair insert_return_type; + + s0.insert(1); + insert_return_type irt1 = s0.insert(2); + insert_return_type irt2 = s0.insert(3); + + iterator pos1 = s0.erase(irt1.first); + VERIFY( pos1 == irt2.first ); + + iterator pos2 = s0.erase(irt2.first); + VERIFY( pos2 == s0.end() ); +} + +void +test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + set s0; + typedef set::iterator iterator; + typedef set::const_iterator const_iterator; + typedef pair insert_return_type; + + insert_return_type irt0 = s0.insert(1); + s0.insert(2); + insert_return_type irt2 = s0.insert(3); + insert_return_type irt3 = s0.insert(4); + + iterator pos1 = s0.erase(irt0.first, irt2.first); + VERIFY( pos1 == irt2.first ); + + iterator pos2 = s0.erase(irt2.first, ++irt3.first); + VERIFY( pos2 == s0.end() ); +} + +int +main() +{ + test01(); + test02(); +} diff --git a/libstdc++-v3/testsuite/23_containers/set/init-list.cc b/libstdc++-v3/testsuite/23_containers/set/init-list.cc new file mode 100644 index 000000000..e0b3d6b95 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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; + + set m({ 1, 5, 37 }); + VERIFY(m.size() == 3); + VERIFY(m.count(1) == 1); + VERIFY(m.count(5) == 1); + VERIFY(m.count(37) == 1); + VERIFY(m.count(42) == 0); + + m = { 28, 37, 102 }; + VERIFY(m.size() == 3); + VERIFY(m.count(28) == 1); + VERIFY(m.count(37) == 1); + VERIFY(m.count(102) == 1); + VERIFY(m.count(1) == 0); + + m.insert({ 42 }); + VERIFY(m.size() == 4); + VERIFY(m.count(28) == 1); + VERIFY(m.count(37) == 1); + VERIFY(m.count(102) == 1); + VERIFY(m.count(42) == 1); + VERIFY(m.count(1) == 0); + + return test; +} + +int main() +{ + __gnu_test::set_memory_limits(); + test01(); +} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc new file mode 100644 index 000000000..28376a353 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc @@ -0,0 +1,92 @@ +// Copyright (C) 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 +// . + + +/* + * The goal with this application is to compare the performance + * between different std::allocator implementations. The results are + * influenced by the underlying allocator in the "C" library, malloc. + */ + +#include +#include + +using namespace std; + +typedef int test_type; + +// This can take extremely long on simulators, timing out the test. +// { dg-options "-DITERATIONS=10" { target simulator } } +#ifndef ITERATIONS +#define ITERATIONS 10000 +#endif + +// The number of iterations to be performed. +int iterations = ITERATIONS; + +// The number of values to insert in the container, 32 will cause 5 +// (re)allocations to be performed (sizes 4, 8, 16, 32 and 64) +// This means that all allocations are within _MAX_BYTES = 128 as +// defined in stl_alloc.h for __pool_alloc. Whether or not this +// value is relevant in "the real world" or not I don't know and +// should probably be investigated in more detail. +int insert_values = 128; + +template + struct value_type : public pair + { + value_type() : pair(0, 0) { } + + inline value_type operator++() { return ++this->first, *this; } + inline operator TestType() const { return this->first; } + }; + +template + void + do_loop() + { + Container obj; + int test_iterations = 0; + value_type test_value; + while (test_iterations < iterations) + { + for (int j = 0; j < insert_values; ++j) + obj.insert(obj.end(), ++test_value); + ++test_iterations; + } + } + +template + void + test_container(Container, bool run_threaded = false) + { + do_loop(); + std::ostringstream comment; + if (run_threaded) + comment << "4-way threaded iterations: " << iterations*4 << '\t'; + else + comment << "iterations: " << iterations << '\t'; + } + +// http://gcc.gnu.org/ml/libstdc++/2001-05/msg00105.html +// http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html +int main(void) +{ + typedef less compare_type; + test_container(set()); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/17948.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/17948.cc new file mode 100644 index 000000000..baee1fe8a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/17948.cc @@ -0,0 +1,44 @@ +// Copyright (C) 2004, 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 + +// libstdc++/17948 +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + typedef set::size_type size_type; + + set s; + + s.insert(2); + s.insert(3); + + size_type x = s.erase(3); + + VERIFY( s.size() == 1 ); + VERIFY( x == 1 ); +} + +int main () +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/51142.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/51142.cc new file mode 100644 index 000000000..4fb296a95 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set& s, X x) +{ + std::set::iterator it = s.find(x); + if (it != s.end()) + s.erase(it); +} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/1.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/1.cc new file mode 100644 index 000000000..0b2dd3e2a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/1.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; + + set s0, s1; + set::iterator iter1; + + s0.insert(1); + s1.insert(s1.end(), 1); + VERIFY( s0 == s1 ); + + s0.insert(3); + s1.insert(s1.begin(), 3); + VERIFY( s0 == s1 ); + + s0.insert(4); + iter1 = s1.insert(s1.end(), 4); + VERIFY( s0 == s1 ); + + s0.insert(6); + s1.insert(iter1, 6); + VERIFY( s0 == s1 ); + + s0.insert(2); + s1.insert(s1.begin(), 2); + VERIFY( s0 == s1 ); + + s0.insert(7); + s1.insert(s1.end(), 7); + VERIFY( s0 == s1 ); + + s0.insert(5); + s1.insert(s1.find(4), 5); + VERIFY( s0 == s1 ); + + s0.insert(0); + s1.insert(s1.end(), 0); + VERIFY( s0 == s1 ); + + s0.insert(8); + s1.insert(s1.find(3), 8); + VERIFY( s0 == s1 ); + + s0.insert(9); + s1.insert(s1.end(), 9); + VERIFY( s0 == s1 ); + + s0.insert(10); + s1.insert(s1.begin(), 10); + VERIFY( s0 == s1 ); +} + +int main () +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/2.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/2.cc new file mode 100644 index 000000000..31159262b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/2.cc @@ -0,0 +1,67 @@ +// { 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::set Set; + Set s; + VERIFY( s.empty() ); + + std::pair p = s.insert(rvalstruct(1)); + VERIFY( p.second ); + VERIFY( s.size() == 1 ); + VERIFY( std::distance(s.begin(), s.end()) == 1 ); + VERIFY( p.first == s.begin() ); + VERIFY( (*p.first).val == 1 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::set Set; + Set s; + VERIFY( s.empty() ); + + std::pair p1 = s.insert(rvalstruct(2)); + std::pair p2 = s.insert(rvalstruct(2)); + VERIFY( p1.second ); + VERIFY( !p2.second ); + VERIFY( s.size() == 1 ); + VERIFY( p1.first == p2.first ); + VERIFY( (*p1.first).val == 2 ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/3.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/3.cc new file mode 100644 index 000000000..03e0d9d6c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/3.cc @@ -0,0 +1,64 @@ +// { 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::set Set; + Set s; + VERIFY( s.empty() ); + + Set::iterator p = s.insert(s.begin(), rvalstruct(1)); + VERIFY( s.size() == 1 ); + VERIFY( std::distance(s.begin(), s.end()) == 1 ); + VERIFY( p == s.begin() ); + VERIFY( (*p).val == 1 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::rvalstruct; + + typedef std::set Set; + Set s; + VERIFY( s.empty() ); + + Set::iterator p1 = s.insert(s.begin(), rvalstruct(2)); + Set::iterator p2 = s.insert(p1, rvalstruct(2)); + VERIFY( s.size() == 1 ); + VERIFY( p1 == p2 ); + VERIFY( (*p1).val == 2 ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/1.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/1.cc new file mode 100644 index 000000000..789185f8f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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 + set::swap(set&) + { ++swap_calls; } +} + +// Should use set specialization for swap. +void test01() +{ + bool test __attribute__((unused)) = true; + std::set A; + std::set B; + swap_calls = 0; + std::swap(A, B); + VERIFY(1 == swap_calls); +} + +// Should use set specialization for swap. +void test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + set A; + set 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/set/modifiers/swap/2.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/2.cc new file mode 100644 index 000000000..8899b6dae --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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.3 set::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 set, my_alloc> my_set; + + 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 set set01_ref(title01, title01 + N1); + const set set02_ref(title02, title02 + N2); + const set set03_ref(title03, title03 + N3); + const set set04_ref(title04, title04 + N4); + + my_set::size_type size01, size02; + + my_alloc alloc01(1); + + my_set set01(less(), alloc01); + size01 = set01.size(); + my_set set02(less(), alloc01); + size02 = set02.size(); + + set01.swap(set02); + VERIFY( set01.size() == size02 ); + VERIFY( set01.empty() ); + VERIFY( set02.size() == size01 ); + VERIFY( set02.empty() ); + + my_set set03(less(), alloc01); + size01 = set03.size(); + my_set set04(title02, title02 + N2, less(), alloc01); + size02 = set04.size(); + + set03.swap(set04); + VERIFY( set03.size() == size02 ); + VERIFY( equal(set03.begin(), set03.end(), set02_ref.begin()) ); + VERIFY( set04.size() == size01 ); + VERIFY( set04.empty() ); + + my_set set05(title01, title01 + N1, less(), alloc01); + size01 = set05.size(); + my_set set06(title02, title02 + N2, less(), alloc01); + size02 = set06.size(); + + set05.swap(set06); + VERIFY( set05.size() == size02 ); + VERIFY( equal(set05.begin(), set05.end(), set02_ref.begin()) ); + VERIFY( set06.size() == size01 ); + VERIFY( equal(set06.begin(), set06.end(), set01_ref.begin()) ); + + my_set set07(title01, title01 + N1, less(), alloc01); + size01 = set07.size(); + my_set set08(title03, title03 + N3, less(), alloc01); + size02 = set08.size(); + + set07.swap(set08); + VERIFY( set07.size() == size02 ); + VERIFY( equal(set07.begin(), set07.end(), set03_ref.begin()) ); + VERIFY( set08.size() == size01 ); + VERIFY( equal(set08.begin(), set08.end(), set01_ref.begin()) ); + + my_set set09(title03, title03 + N3, less(), alloc01); + size01 = set09.size(); + my_set set10(title04, title04 + N4, less(), alloc01); + size02 = set10.size(); + + set09.swap(set10); + VERIFY( set09.size() == size02 ); + VERIFY( equal(set09.begin(), set09.end(), set04_ref.begin()) ); + VERIFY( set10.size() == size01 ); + VERIFY( equal(set10.begin(), set10.end(), set03_ref.begin()) ); + + my_set set11(title04, title04 + N4, less(), alloc01); + size01 = set11.size(); + my_set set12(title01, title01 + N1, less(), alloc01); + size02 = set12.size(); + + set11.swap(set12); + VERIFY( set11.size() == size02 ); + VERIFY( equal(set11.begin(), set11.end(), set01_ref.begin()) ); + VERIFY( set12.size() == size01 ); + VERIFY( equal(set12.begin(), set12.end(), set04_ref.begin()) ); + + my_set set13(title03, title03 + N3, less(), alloc01); + size01 = set13.size(); + my_set set14(title03, title03 + N3, less(), alloc01); + size02 = set14.size(); + + set13.swap(set14); + VERIFY( set13.size() == size02 ); + VERIFY( equal(set13.begin(), set13.end(), set03_ref.begin()) ); + VERIFY( set14.size() == size01 ); + VERIFY( equal(set14.begin(), set14.end(), set03_ref.begin()) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/3.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/3.cc new file mode 100644 index 000000000..5f192293d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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.3 set::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 set, my_alloc> my_set; + + 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 set set01_ref(title01, title01 + N1); + const set set02_ref(title02, title02 + N2); + const set set03_ref(title03, title03 + N3); + const set set04_ref(title04, title04 + N4); + + my_set::size_type size01, size02; + + my_alloc alloc01(1), alloc02(2); + int personality01, personality02; + + my_set set01(less(), alloc01); + size01 = set01.size(); + personality01 = set01.get_allocator().get_personality(); + my_set set02(less(), alloc02); + size02 = set02.size(); + personality02 = set02.get_allocator().get_personality(); + + set01.swap(set02); + VERIFY( set01.size() == size02 ); + VERIFY( set01.empty() ); + VERIFY( set02.size() == size01 ); + VERIFY( set02.empty() ); + VERIFY( set01.get_allocator().get_personality() == personality02 ); + VERIFY( set02.get_allocator().get_personality() == personality01 ); + + my_set set03(less(), alloc02); + size01 = set03.size(); + personality01 = set03.get_allocator().get_personality(); + my_set set04(title02, title02 + N2, less(), alloc01); + size02 = set04.size(); + personality02 = set04.get_allocator().get_personality(); + + set03.swap(set04); + VERIFY( set03.size() == size02 ); + VERIFY( equal(set03.begin(), set03.end(), set02_ref.begin()) ); + VERIFY( set04.size() == size01 ); + VERIFY( set04.empty() ); + VERIFY( set03.get_allocator().get_personality() == personality02 ); + VERIFY( set04.get_allocator().get_personality() == personality01 ); + + my_set set05(title01, title01 + N1, less(), alloc01); + size01 = set05.size(); + personality01 = set05.get_allocator().get_personality(); + my_set set06(title02, title02 + N2, less(), alloc02); + size02 = set06.size(); + personality02 = set06.get_allocator().get_personality(); + + set05.swap(set06); + VERIFY( set05.size() == size02 ); + VERIFY( equal(set05.begin(), set05.end(), set02_ref.begin()) ); + VERIFY( set06.size() == size01 ); + VERIFY( equal(set06.begin(), set06.end(), set01_ref.begin()) ); + VERIFY( set05.get_allocator().get_personality() == personality02 ); + VERIFY( set06.get_allocator().get_personality() == personality01 ); + + my_set set07(title01, title01 + N1, less(), alloc02); + size01 = set07.size(); + personality01 = set07.get_allocator().get_personality(); + my_set set08(title03, title03 + N3, less(), alloc01); + size02 = set08.size(); + personality02 = set08.get_allocator().get_personality(); + + set07.swap(set08); + VERIFY( set07.size() == size02 ); + VERIFY( equal(set07.begin(), set07.end(), set03_ref.begin()) ); + VERIFY( set08.size() == size01 ); + VERIFY( equal(set08.begin(), set08.end(), set01_ref.begin()) ); + VERIFY( set07.get_allocator().get_personality() == personality02 ); + VERIFY( set08.get_allocator().get_personality() == personality01 ); + + my_set set09(title03, title03 + N3, less(), alloc01); + size01 = set09.size(); + personality01 = set09.get_allocator().get_personality(); + my_set set10(title04, title04 + N4, less(), alloc02); + size02 = set10.size(); + personality02 = set10.get_allocator().get_personality(); + + set09.swap(set10); + VERIFY( set09.size() == size02 ); + VERIFY( equal(set09.begin(), set09.end(), set04_ref.begin()) ); + VERIFY( set10.size() == size01 ); + VERIFY( equal(set10.begin(), set10.end(), set03_ref.begin()) ); + VERIFY( set09.get_allocator().get_personality() == personality02 ); + VERIFY( set10.get_allocator().get_personality() == personality01 ); + + my_set set11(title04, title04 + N4, less(), alloc02); + size01 = set11.size(); + personality01 = set11.get_allocator().get_personality(); + my_set set12(title01, title01 + N1, less(), alloc01); + size02 = set12.size(); + personality02 = set12.get_allocator().get_personality(); + + set11.swap(set12); + VERIFY( set11.size() == size02 ); + VERIFY( equal(set11.begin(), set11.end(), set01_ref.begin()) ); + VERIFY( set12.size() == size01 ); + VERIFY( equal(set12.begin(), set12.end(), set04_ref.begin()) ); + VERIFY( set11.get_allocator().get_personality() == personality02 ); + VERIFY( set12.get_allocator().get_personality() == personality01 ); + + my_set set13(title03, title03 + N3, less(), alloc01); + size01 = set13.size(); + personality01 = set13.get_allocator().get_personality(); + my_set set14(title03, title03 + N3, less(), alloc02); + size02 = set14.size(); + personality02 = set14.get_allocator().get_personality(); + + set13.swap(set14); + VERIFY( set13.size() == size02 ); + VERIFY( equal(set13.begin(), set13.end(), set03_ref.begin()) ); + VERIFY( set14.size() == size01 ); + VERIFY( equal(set14.begin(), set14.end(), set03_ref.begin()) ); + VERIFY( set13.get_allocator().get_personality() == personality02 ); + VERIFY( set14.get_allocator().get_personality() == personality01 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/operations/1.cc b/libstdc++-v3/testsuite/23_containers/set/operations/1.cc new file mode 100644 index 000000000..7b828930a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/operations/1.cc @@ -0,0 +1,126 @@ +// 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; + + set s0; + typedef set::iterator iterator; + typedef pair insert_return_type; + pair pp0; + + pp0 = s0.equal_range(1); + VERIFY( s0.count(1) == 0 ); + VERIFY( pp0.first == s0.end() ); + VERIFY( pp0.second == s0.end() ); + + insert_return_type irt0 = s0.insert(1); + insert_return_type irt1 = s0.insert(2); + insert_return_type irt2 = s0.insert(3); + + pp0 = s0.equal_range(2); + VERIFY( s0.count(2) == 1 ); + VERIFY( *pp0.first == 2 ); + VERIFY( *pp0.second == 3 ); + VERIFY( pp0.first == irt1.first ); + VERIFY( --pp0.first == irt0.first ); + VERIFY( pp0.second == irt2.first ); + + s0.insert(3); + insert_return_type irt3 = s0.insert(3); + insert_return_type irt4 = s0.insert(4); + + pp0 = s0.equal_range(3); + VERIFY( s0.count(3) == 1 ); + VERIFY( *pp0.first == 3 ); + VERIFY( *pp0.second == 4 ); + VERIFY( pp0.first == irt2.first ); + VERIFY( --pp0.first == irt1.first ); + VERIFY( pp0.second == irt4.first ); + + insert_return_type irt5 = s0.insert(0); + s0.insert(1); + s0.insert(1); + s0.insert(1); + + pp0 = s0.equal_range(1); + VERIFY( s0.count(1) == 1 ); + VERIFY( *pp0.first == 1 ); + VERIFY( *pp0.second == 2 ); + VERIFY( pp0.first == irt0.first ); + VERIFY( --pp0.first == irt5.first ); + VERIFY( pp0.second == irt1.first ); + + insert_return_type irt6 = s0.insert(5); + s0.insert(5); + s0.insert(5); + + pp0 = s0.equal_range(5); + VERIFY( s0.count(5) == 1 ); + VERIFY( *pp0.first == 5 ); + VERIFY( pp0.first == irt6.first ); + VERIFY( --pp0.first == irt4.first ); + VERIFY( pp0.second == s0.end() ); + + s0.insert(4); + s0.insert(4); + s0.insert(4); + + pp0 = s0.equal_range(4); + VERIFY( s0.count(4) == 1 ); + VERIFY( *pp0.first == 4 ); + VERIFY( *pp0.second == 5 ); + VERIFY( pp0.first == irt4.first ); + VERIFY( --pp0.first == irt3.first ); + VERIFY( pp0.second == irt6.first ); + + s0.insert(0); + insert_return_type irt7 = s0.insert(0); + s0.insert(1); + + pp0 = s0.equal_range(0); + VERIFY( s0.count(0) == 1 ); + VERIFY( *pp0.first == 0 ); + VERIFY( *pp0.second == 1 ); + VERIFY( pp0.first == irt5.first ); + VERIFY( pp0.first == s0.begin() ); + VERIFY( pp0.second == irt0.first ); + + pp0 = s0.equal_range(1); + VERIFY( s0.count(1) == 1 ); + VERIFY( *pp0.first == 1 ); + VERIFY( *pp0.second == 2 ); + VERIFY( pp0.first == irt0.first ); + VERIFY( --pp0.first == irt7.first ); + VERIFY( pp0.second == irt1.first ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc new file mode 100644 index 000000000..babd6db2b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// Copyright (C) 2000, 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 +// 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 negative tests +// 2000-09-07 bgarcia@laurelnetworks.com + +#include +#include + +// libstdc++/86: map & set iterator comparisons are not type-safe +void test01() +{ + bool test __attribute__((unused)) = true; + + std::set setByIndex; + std::set setByName; + + std::set::iterator itr(setByIndex.begin()); + + // NB: it's not setByIndex!! + test &= itr != setByName.end(); // { dg-error "no" } + test &= itr == setByName.end(); // { dg-error "no" } +} + +// { dg-excess-errors "" } diff --git a/libstdc++-v3/testsuite/23_containers/set/range_access.cc b/libstdc++-v3/testsuite/23_containers/set/range_access.cc new file mode 100644 index 000000000..b1c33b773 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set s{1, 2, 3}; + std::begin(s); + std::end(s); +} diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc new file mode 100644 index 000000000..20dd8b9f1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set test_type; + __gnu_test::citerator test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc new file mode 100644 index 000000000..d9146e30c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set 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/set/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/generation_prohibited.cc new file mode 100644 index 000000000..0536b99ac --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set test_type; + __gnu_test::generation_prohibited test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/propagation_consistent.cc new file mode 100644 index 000000000..dccfd3a5f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set test_type; + __gnu_test::propagation_consistent test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1.cc new file mode 100644 index 000000000..0b8550590 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set; diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1_c++0x.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1_c++0x.cc new file mode 100644 index 000000000..e957decf0 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set; diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..181e9ce6a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set<__gnu_test::NonDefaultConstructible>; diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/3.cc new file mode 100644 index 000000000..1cc37c731 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set, std::allocator >; diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc new file mode 100644 index 000000000..2bbe97667 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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::set<__gnu_test::OverloadedAddress>; diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/partial_specialization/1.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/partial_specialization/1.cc new file mode 100644 index 000000000..d57aec669 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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 set {}; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc new file mode 100644 index 000000000..0581e49ec --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/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