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. --- .../23_containers/forward_list/capacity/1.cc | 54 ++++++++ .../forward_list/capacity/resize_size.cc | 43 ++++++ .../23_containers/forward_list/comparable.cc | 50 +++++++ .../testsuite/23_containers/forward_list/cons/1.cc | 40 ++++++ .../testsuite/23_containers/forward_list/cons/2.cc | 45 ++++++ .../testsuite/23_containers/forward_list/cons/3.cc | 43 ++++++ .../testsuite/23_containers/forward_list/cons/4.cc | 40 ++++++ .../testsuite/23_containers/forward_list/cons/5.cc | 40 ++++++ .../testsuite/23_containers/forward_list/cons/6.cc | 43 ++++++ .../testsuite/23_containers/forward_list/cons/7.cc | 44 ++++++ .../testsuite/23_containers/forward_list/cons/8.cc | 44 ++++++ .../testsuite/23_containers/forward_list/cons/9.cc | 40 ++++++ .../23_containers/forward_list/cons/cons_size.cc | 40 ++++++ .../23_containers/forward_list/cons/moveable.cc | 47 +++++++ .../23_containers/forward_list/debug/clear.cc | 43 ++++++ .../forward_list/debug/erase_after1_neg.cc | 45 ++++++ .../forward_list/debug/erase_after2_neg.cc | 36 +++++ .../forward_list/debug/erase_after3_neg.cc | 36 +++++ .../forward_list/debug/erase_after4_neg.cc | 38 +++++ .../forward_list/debug/erase_after5_neg.cc | 38 +++++ .../forward_list/debug/erase_after6_neg.cc | 37 +++++ .../forward_list/debug/erase_after7_neg.cc | 37 +++++ .../forward_list/debug/erase_after8_neg.cc | 37 +++++ .../forward_list/debug/erase_after9_neg.cc | 39 ++++++ .../forward_list/debug/insert_after1_neg.cc | 38 +++++ .../forward_list/debug/insert_after2_neg.cc | 38 +++++ .../forward_list/debug/insert_after3_neg.cc | 37 +++++ .../forward_list/debug/move_constructor.cc | 43 ++++++ .../forward_list/debug/splice_after.cc | 44 ++++++ .../forward_list/debug/splice_after1_neg.cc | 36 +++++ .../forward_list/debug/splice_after2_neg.cc | 38 +++++ .../forward_list/debug/splice_after3_neg.cc | 38 +++++ .../forward_list/debug/splice_after4_neg.cc | 39 ++++++ .../23_containers/forward_list/debug/swap.cc | 79 +++++++++++ .../23_containers/forward_list/modifiers/1.cc | 72 ++++++++++ .../23_containers/forward_list/modifiers/2.cc | 154 +++++++++++++++++++++ .../23_containers/forward_list/modifiers/3.cc | 97 +++++++++++++ .../23_containers/forward_list/modifiers/4.cc | 46 ++++++ .../23_containers/forward_list/modifiers/5.cc | 46 ++++++ .../23_containers/forward_list/operations/1.cc | 106 ++++++++++++++ .../23_containers/forward_list/operations/2.cc | 50 +++++++ .../23_containers/forward_list/operations/3.cc | 47 +++++++ .../23_containers/forward_list/operations/4.cc | 77 +++++++++++ .../23_containers/forward_list/operations/5.cc | 48 +++++++ .../23_containers/forward_list/operations/6.cc | 83 +++++++++++ .../23_containers/forward_list/operations/7.cc | 54 ++++++++ .../forward_list/operations/remove_freed.cc | 94 +++++++++++++ .../23_containers/forward_list/range_access.cc | 31 +++++ .../forward_list/requirements/citerators.cc | 41 ++++++ .../forward_list/requirements/dr438/assign_neg.cc | 35 +++++ .../forward_list/requirements/dr438/constructor.cc | 27 ++++ .../requirements/dr438/constructor_1_neg.cc | 29 ++++ .../requirements/dr438/constructor_2_neg.cc | 30 ++++ .../forward_list/requirements/dr438/insert_neg.cc | 35 +++++ .../forward_list/requirements/exception/basic.cc | 40 ++++++ .../exception/generation_prohibited.cc | 34 +++++ .../exception/propagation_consistent.cc | 34 +++++ .../requirements/explicit_instantiation/1.cc | 27 ++++ .../requirements/explicit_instantiation/3.cc | 28 ++++ .../requirements/explicit_instantiation/4.cc | 32 +++++ .../forward_list/requirements/typedefs.cc | 25 ++++ 61 files changed, 2851 insertions(+) create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/capacity/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/capacity/resize_size.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/4.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/6.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/7.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/8.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/9.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/clear.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after3_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after4_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after5_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after6_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after7_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after8_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after9_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after3_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/move_constructor.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after3_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after4_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/debug/swap.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/modifiers/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/modifiers/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/modifiers/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/modifiers/4.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/modifiers/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/operations/2.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/operations/4.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/operations/6.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/operations/7.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/operations/remove_freed.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/basic.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/generation_prohibited.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/propagation_consistent.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/1.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/3.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/4.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/typedefs.cc (limited to 'libstdc++-v3/testsuite/23_containers/forward_list') diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/capacity/1.cc b/libstdc++-v3/testsuite/23_containers/forward_list/capacity/1.cc new file mode 100644 index 000000000..702acfe34 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/capacity/1.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// 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.2.3.n forward_list capacity [lib.forward_list.capacity] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::forward_list fld; + VERIFY(fld.empty() == true); + + fld.push_front(1.0); + VERIFY(fld.empty() == false); + + fld.resize(0); + VERIFY(fld.empty() == true); + +#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE) + using std::_GLIBCXX_STD_C::_Fwd_list_node; +#else + using std::_Fwd_list_node; +#endif + + VERIFY( (fld.max_size() + == std::allocator<_Fwd_list_node >().max_size()) ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/capacity/resize_size.cc b/libstdc++-v3/testsuite/23_containers/forward_list/capacity/resize_size.cc new file mode 100644 index 000000000..e22af3cbc --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/capacity/resize_size.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-02-01 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 + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::forward_list<__gnu_test::NonCopyConstructible> fl; + VERIFY( std::distance(fl.begin(), fl.end()) == 0 ); + + fl.resize(1000); + VERIFY( std::distance(fl.begin(), fl.end()) == 1000 ); + for(auto it = fl.begin(); it != fl.end(); ++it) + VERIFY( *it == -1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc b/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc new file mode 100644 index 000000000..d05461917 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on list (via swap). If the implementation changed +// this test may begin to fail. + +#include +#include + +bool test __attribute__((unused)) = true; + +int main() +{ + std::forward_list a = {0.0, 1.0, 2.0, 3.0, 4.0}; + std::forward_list b = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; + + VERIFY((a == b) == false); + VERIFY((a < b) == true); + VERIFY((a != b) == true); + VERIFY((a > b) == false); + VERIFY((a >= b) == false); + VERIFY((a <= b) == true); + + VERIFY((b == a) == false); + VERIFY((b < a) == false); + VERIFY((b != a) == true); + VERIFY((b > a) == true); + VERIFY((b >= a) == true); + VERIFY((b <= a) == false); + + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/1.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/1.cc new file mode 100644 index 000000000..7dec2a4b4 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/1.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// Default construction +void +test01() +{ + std::forward_list fld; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/2.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/2.cc new file mode 100644 index 000000000..eb447274b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/2.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// Construction from iterator range +// Copy construction with allocator +void +test01() +{ + const int ni = 10; + int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + std::forward_list flccin(i, i+ni); + std::forward_list flcc(flccin, std::allocator()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/3.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/3.cc new file mode 100644 index 000000000..6197731cb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/3.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// Move construction with allocator +void +test01() +{ + const int ni = 10; + int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + std::forward_list flmc(std::forward_list(i, i+ni), std::allocator()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/4.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/4.cc new file mode 100644 index 000000000..3d23719ca --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/4.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// Construction from given number of default item +void +test01() +{ + std::forward_list flvd(10); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/5.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/5.cc new file mode 100644 index 000000000..ca7b5f7e6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/5.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// Construction from given number of given item +void +test01() +{ + std::forward_list flv(10, 5.0F); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/6.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/6.cc new file mode 100644 index 000000000..f385661f2 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/6.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// Construction from iterator range +void +test01() +{ + const int ni = 10; + int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + std::forward_list fl(i, i+ni); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/7.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/7.cc new file mode 100644 index 000000000..f03779134 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/7.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// Copy construction +void +test01() +{ + const int ni = 10; + int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + std::forward_list fl(i, i+ni); + std::forward_list flc(fl); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/8.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/8.cc new file mode 100644 index 000000000..3cf4288f4 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/8.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// Move construction +void +test01() +{ + const int ni = 10; + int i[ni] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + std::forward_list fl(i, i+ni); + std::forward_list flm(std::move(fl)); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/9.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/9.cc new file mode 100644 index 000000000..ce7bb8597 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/9.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following. +// Construction from initializer list +void +test01() +{ + std::forward_list flil({1.0, 2.0, 3.0, 4.0, 5.0}); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc new file mode 100644 index 000000000..3d07f6720 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-02-01 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 + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::forward_list<__gnu_test::NonCopyConstructible> fl(1000); + VERIFY( std::distance(fl.begin(), fl.end()) == 1000 ); + for(auto it = fl.begin(); it != fl.end(); ++it) + VERIFY( *it == -1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc new file mode 100644 index 000000000..e680d3c8e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/moveable.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on list (via swap). If the implementation changed +// this test may begin to fail. + +#include +#include +#include + +bool test __attribute__((unused)) = true; + +int main() +{ + std::forward_list a, b; + a.push_front(1); + + b = std::move(a); + VERIFY(b.empty() == false); + VERIFY(*b.begin() == 1); + VERIFY(a.empty() == true); + + std::forward_list c(std::move(b)); + VERIFY(c.empty() == false); + (*c.begin() == 1 ); + VERIFY( b.empty() == true ); + + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/clear.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/clear.cc new file mode 100644 index 000000000..57e0e2f53 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/clear.cc @@ -0,0 +1,43 @@ +// { 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 +// . + +// Check that iterators ownership is correctly manage on swap. +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + std::forward_list fl{1, 2, 3}; + + auto before = fl.before_begin(); + auto end = fl.end(); + fl.clear(); + + VERIFY( end == fl.end() ); + VERIFY( before == fl.before_begin() ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after1_neg.cc new file mode 100644 index 000000000..8f3607619 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after1_neg.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::forward_list fl1{1, 2, 3}; + + auto it = fl1.begin(); + VERIFY( *it == 1 ); + + fl1.erase_after(fl1.before_begin()); + + VERIFY( *it == 1 ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after2_neg.cc new file mode 100644 index 000000000..2efaa74ca --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after2_neg.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + fl1.erase_after(fl1.end()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after3_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after3_neg.cc new file mode 100644 index 000000000..b17707e61 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after3_neg.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1}; + fl1.erase_after(fl1.begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after4_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after4_neg.cc new file mode 100644 index 000000000..087abcecd --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after4_neg.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + std::forward_list fl2{1, 2, 3}; + + fl1.erase_after(fl1.before_begin(), fl2.begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after5_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after5_neg.cc new file mode 100644 index 000000000..46a74da5f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after5_neg.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + std::forward_list fl2{1, 2, 3}; + + fl1.erase_after(fl2.before_begin(), fl2.begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after6_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after6_neg.cc new file mode 100644 index 000000000..a057c9cfa --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after6_neg.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + + fl1.erase_after(fl1.before_begin(), fl1.before_begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after7_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after7_neg.cc new file mode 100644 index 000000000..49a48f74d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after7_neg.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + + fl1.erase_after(fl1.end(), fl1.begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after8_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after8_neg.cc new file mode 100644 index 000000000..a1ff667f5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after8_neg.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + + fl1.erase_after(fl1.begin(), fl1.before_begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after9_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after9_neg.cc new file mode 100644 index 000000000..3d25787de --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/erase_after9_neg.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + + auto it = fl1.begin(); + ++it; + fl1.erase_after(it, fl1.begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after1_neg.cc new file mode 100644 index 000000000..84d39ae99 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after1_neg.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + std::forward_list fl2{1, 2, 3}; + + fl1.insert_after(fl1.before_begin(), fl2.before_begin(), fl2.end()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after2_neg.cc new file mode 100644 index 000000000..18e1670cc --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after2_neg.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + std::forward_list fl2{0}; + + fl1.insert_after(fl1.before_begin(), fl2.begin(), fl2.before_begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after3_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after3_neg.cc new file mode 100644 index 000000000..325028c72 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/insert_after3_neg.cc @@ -0,0 +1,37 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + + fl1.insert_after(fl1.end(), 4); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_constructor.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_constructor.cc new file mode 100644 index 000000000..6238f6f8f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_constructor.cc @@ -0,0 +1,43 @@ +// { 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 +// . + +// Check that iterators ownership is correctly manage on swap. +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + std::forward_list fl1{1, 3, 5}; + + auto flit = fl1.before_begin(); + std::forward_list fl2(std::move(fl1)); + +#if !_GLIBCXX_DEBUG + VERIFY( flit == fl1.before_begin() ); +#endif +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after.cc new file mode 100644 index 000000000..8a7d49f94 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after.cc @@ -0,0 +1,44 @@ +// { 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 +// . + +// Check that iterators ownership is correctly manage on swap. +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + std::forward_list fl1{1, 2, 3}; + std::forward_list fl2{4, 5, 6}; + + auto before = fl1.before_begin(); + auto end = fl1.end(); + fl2.splice_after(fl2.before_begin(), std::move(fl1)); + + VERIFY( before == fl1.before_begin() ); + VERIFY( end == fl1.end() ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after1_neg.cc new file mode 100644 index 000000000..d0cee48b2 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after1_neg.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + fl1.splice_after(fl1.begin(), std::move(fl1)); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after2_neg.cc new file mode 100644 index 000000000..545562322 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after2_neg.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + std::forward_list fl2{1, 2, 3}; + + fl1.splice_after(fl1.before_begin(), std::move(fl2), fl1.begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after3_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after3_neg.cc new file mode 100644 index 000000000..1e63e90a5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after3_neg.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + std::forward_list fl2{1, 2, 3}; + + fl1.splice_after(fl1.before_begin(), std::move(fl2), fl2.end()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after4_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after4_neg.cc new file mode 100644 index 000000000..9582a8b3e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after4_neg.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-debug-mode "" } +// { dg-do run { xfail *-*-* } } + +// 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 + +void +test01() +{ + std::forward_list fl1{1, 2, 3}; + std::forward_list fl2{1, 2, 3}; + + fl1.splice_after(fl1.before_begin(), + std::move(fl2), ++(++fl2.begin()), ++fl2.begin()); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/swap.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/swap.cc new file mode 100644 index 000000000..85884c0af --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/swap.cc @@ -0,0 +1,79 @@ +// { 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 +// . + +// Check that iterators ownership is correctly manage on swap. +#include +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + std::forward_list fl1{1, 3, 5}; + std::forward_list fl2{2, 4, 6}; + + std::vector::iterator> fl1_its; + fl1_its.push_back(fl1.before_begin()); + for (std::forward_list::iterator it = fl1.begin(); + it != fl1.end(); ++it) + { + fl1_its.push_back(it); + } + fl1_its.push_back(fl1.end()); + + std::vector::iterator> fl2_its; + fl2_its.push_back(fl2.before_begin()); + for (std::forward_list::iterator it = fl2.begin(); + it != fl2.end(); ++it) + { + fl2_its.push_back(it); + } + fl2_its.push_back(fl2.end()); + + fl1.swap(fl2); + + auto fit = fl1.before_begin(); + // before-begin iterator is not transfered: + // TODO: Validate with LWG group how before begin should be + // treated. + VERIFY( fit == fl1_its[0] ); + // All other iterators are, even paste-the-end ones: + for (size_t i = 1; i != fl2_its.size(); ++i) + { + VERIFY( ++fit == fl2_its[i] ); + } + + fit = fl2.before_begin(); + // TODO: Validate with LWG group how before begin should be + // treated. + VERIFY( fit == fl2_its[0] ); + for (size_t i = 1; i != fl1_its.size(); ++i) + { + VERIFY( ++fit == fl1_its[i] ); + } +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/1.cc b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/1.cc new file mode 100644 index 000000000..09ad6aa6e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/1.cc @@ -0,0 +1,72 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +#include + +bool test __attribute__((unused)) = true; + +class PathPoint +{ +public: + PathPoint(char t, std::array & c) + : type(t), coord(c) { } + char getType() const { return type; } +private: + char type; + std::array coord; +}; + +// This test verifies the following. +// emplace_front +// pop_front +// emplace_after +void +test01() +{ + std::forward_list path; + std::array coord1 = { { 0.0, 1.0, 2.0 } }; + path.emplace_front('a', coord1); + + std::forward_list::const_iterator pos = path.cbegin(); + + std::array coord2 = { { 3.0, 4.0, 5.0 } }; + path.emplace_after(pos, 'b', coord2); + + VERIFY(path.front().getType() == 'a'); + + path.pop_front(); + + VERIFY(path.front().getType() == 'b'); + + path.pop_front(); + + VERIFY(path.empty() == true); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/2.cc b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/2.cc new file mode 100644 index 000000000..b6c6e35eb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/2.cc @@ -0,0 +1,154 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// 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.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// insert_after single item +// before_begin iterator +void +test01() +{ + std::forward_list fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); + + std::forward_list::iterator ret = fl.insert_after(fl.before_begin(), + 42); + VERIFY( ret == fl.begin() ); + VERIFY( fl.front() == 42 ); +} + +// This test verifies the following: +void +test02() +{ + std::forward_list fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); + + std::forward_list::const_iterator pos = fl.cbegin(); + ++pos; + VERIFY( *pos == 1 ); + + std::forward_list::iterator ret = fl.insert_after(pos, 0, 42); + VERIFY( ret == pos ); + + ret = fl.insert_after(pos, 5, 42); + VERIFY( *pos == 1 ); + + ++pos; + VERIFY( *pos == 42 ); + ++pos; + ++pos; + ++pos; + ++pos; + VERIFY( *pos == 42 ); + VERIFY( ret == pos ); + ++pos; + VERIFY( *pos == 2 ); +} + +// This test verifies the following: +void +test03() +{ + std::forward_list fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); + + std::forward_list::const_iterator pos = fl.cbegin(); + ++pos; + VERIFY( *pos == 1 ); + + int i[3] = {666, 777, 888}; + std::forward_list::iterator ret = fl.insert_after(pos, i, i); + VERIFY( ret == pos ); + + ret = fl.insert_after(pos, i, i + 3); + VERIFY( *pos == 1 ); + + ++pos; + ++pos; + ++pos; + VERIFY( *pos == 888 ); + VERIFY( ret == pos ); + ++pos; + VERIFY( *pos == 2 ); +} + +// This test verifies the following: +void +test04() +{ + std::forward_list fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); + + std::forward_list::const_iterator pos = fl.cbegin(); + ++pos; + VERIFY( *pos == 1 ); + + std::forward_list::iterator ret = fl.insert_after(pos, { }); + VERIFY( ret == pos); + + ret = fl.insert_after(pos, {-1, -2, -3, -4, -5}); + VERIFY( *pos == 1); + + ++pos; + ++pos; + ++pos; + VERIFY( *pos == -3 ); + ++pos; + ++pos; + VERIFY( ret == pos ); + ++pos; + VERIFY( *pos == 2 ); +} + +// This test verifies the following: +void +test05() +{ + std::forward_list fl({"AAA", "BBB", "CCC"}); + + std::forward_list::const_iterator pos = fl.cbegin(); + ++pos; + VERIFY( *pos == "BBB" ); + + std::string x( "XXX" ); + std::forward_list::iterator ret + = fl.insert_after(pos, std::move(x)); + VERIFY( *pos == "BBB" ); + ++pos; + VERIFY( ret == pos ); + VERIFY( *pos == "XXX" ); + ++pos; + VERIFY( *pos == "CCC" ); +} + +int +main() +{ + test01(); + test02(); + test03(); + test04(); + test05(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/3.cc b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/3.cc new file mode 100644 index 000000000..349be4c2e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/3.cc @@ -0,0 +1,97 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// 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.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +// This test verifies the following: +// cbegin +// erase_after one iterator +// pos is useable and points to current element +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::forward_list fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); + + std::forward_list::const_iterator pos = fl.cbegin(); + ++pos; + VERIFY( *pos == 1 ); + + std::forward_list::iterator pos2 = fl.erase_after(pos); + + VERIFY( *pos == 1 ); + ++pos; + VERIFY( *pos == 3 ); + VERIFY( pos == pos2 ); +} + +// This test verifies the following: +// cbegin +// erase_after iterator range +// pos is useable and points to current element +void +test02() +{ + bool test __attribute__((unused)) = true; + + std::forward_list fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); + + std::forward_list::const_iterator pos = fl.cbegin(); + ++pos; + VERIFY( *pos == 1 ); + + std::forward_list::iterator stop = fl.begin(); + ++stop; + ++stop; + ++stop; + ++stop; + VERIFY( *stop == 4 ); + + std::forward_list::iterator pos2 = fl.erase_after(pos, stop); + + VERIFY( pos2 == stop ); + VERIFY( *pos == 1 ); + ++pos; + VERIFY( *pos == 4 ); + VERIFY( std::distance(fl.begin(), fl.end()) == 8 ); + + std::forward_list::iterator pos3 + = fl.erase_after(pos, fl.end()); + VERIFY( pos3 == fl.end() ); + VERIFY( ++pos == fl.end() ); + VERIFY( std::distance(fl.begin(), fl.end()) == 3 ); + + std::forward_list::iterator pos4 + = fl.erase_after(fl.before_begin(), pos); + VERIFY( pos4 == pos ); + VERIFY( std::distance(fl.begin(), fl.end()) == 0 ); + VERIFY( fl.empty() ); +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/4.cc b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/4.cc new file mode 100644 index 000000000..554ac030d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/4.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// swap +void +test01() +{ + std::forward_list fl1({0, 1, 2, 3, 4, 5}); + std::forward_list fl2({666, 777, 888}); + + fl1.swap(fl2); + + VERIFY(fl1.front() == 666); + VERIFY(fl2.front() == 0); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/5.cc b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/5.cc new file mode 100644 index 000000000..26a422665 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/5.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// clear +void +test01() +{ + std::forward_list fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); + + VERIFY(fl.empty() == false); + + fl.clear(); + + VERIFY(fl.empty() == true); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc new file mode 100644 index 000000000..c4794d358 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc @@ -0,0 +1,106 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// +void +test01() +{ + std::forward_list a = {0.0, 1.0, 2.0, 3.0, 4.0}; + std::forward_list::const_iterator posa = a.cbefore_begin(); + + std::forward_list x = {666.0, 777.0, 888.0}; + + a.splice_after(posa, std::move(x)); + + ++posa; + VERIFY(*posa == 666.0); + + VERIFY(x.empty() == true); +} + +// This test verifies the following: +// +void +test02() +{ + std::forward_list a = {0.0, 1.0, 2.0, 3.0, 4.0}; + std::forward_list::const_iterator posa = a.cbefore_begin(); + ++posa; + VERIFY(*posa == 0.0); + + std::forward_list y = {10.0, 11.0, 12.0, 13.0, 14.0, 15.0}; + std::forward_list::const_iterator befy = y.cbefore_begin(); + ++befy; + VERIFY(*befy == 10.0); + std::forward_list::const_iterator endy = befy; + ++endy; + ++endy; + ++endy; + ++endy; + VERIFY(*endy == 14.0); + + a.splice_after(posa, std::move(y), befy, endy); + VERIFY(*posa == 0.0); + + VERIFY(*befy == 10.0); + ++befy; + VERIFY(*befy == 15.0); +} + +// This test verifies the following: +// +void +test03() +{ + std::forward_list a = {0.0, 1.0, 2.0, 3.0, 4.0}; + std::forward_list::const_iterator posa = a.cbefore_begin(); + ++posa; + ++posa; + VERIFY(*posa == 1.0); + + std::forward_list z = {42.0, 43.0, 44.0}; + std::forward_list::const_iterator posz = z.begin(); + VERIFY(*posz == 42.0); + + a.splice_after(posa, std::move(z), posz); + VERIFY(*posa == 1.0); + ++posa; + VERIFY(*posa == 43.0); + + VERIFY(*posz == 42.0); + ++posz; + VERIFY(*posz == 44.0); +} + +int +main() +{ + test01(); + test02(); + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/2.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/2.cc new file mode 100644 index 000000000..fe12af9aa --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/2.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// remove +void +test01() +{ + std::forward_list fl ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + fl.remove(7); + + std::forward_list::const_iterator pos = fl.cbefore_begin(); + for (std::size_t i = 0; i < 7; ++i) + ++pos; + VERIFY(*pos == 6); + + ++pos; + VERIFY(*pos == 8); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc new file mode 100644 index 000000000..f112bc2d8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// remove_if +void +test01() +{ + std::forward_list fl ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + fl.remove_if(std::bind2nd(std::less(),5)); + + std::forward_list::const_iterator pos = fl.cbegin(); + VERIFY(*pos == 5); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/4.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/4.cc new file mode 100644 index 000000000..6c09065e5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/4.cc @@ -0,0 +1,77 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// unique +void +test01() +{ + std::forward_list fl = {99, 5, 99, 6, -5, 666, 777, 888, + 42, 42, 42, 42, 42, 7, 0, 0, 0, 9, 9, 9}; + + fl.unique(); + + std::forward_list fl2 = {99, 5, 99, 6, -5, 666, 777, 888, 42, 7, 0, 9}; + VERIFY(fl == fl2); +} + +// Test comparison predicate. +template + class Mod + { + public: + Mod(const Num & mod) + { + m = mod; + } + bool operator()(const Num i, const Num j) + { + return i%m == j%m; + } + private: + Num m; + }; + +// This test verifies the following: +// unique with predicate +void +test02() +{ + std::forward_list fl = {99, 5, 99, 6, -5, 666, 777, 888, 42, 7, 0, 9}; + + fl.unique(Mod(111)); + + std::forward_list fl2 = {99, 5, 99, 6, -5, 666, 42, 7, 0, 9}; + VERIFY(fl == fl2); +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc new file mode 100644 index 000000000..55d1634c4 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// +void +test01() +{ + std::forward_list a = {0.0, 1.0, 2.0, 3.0, 4.0}; + std::forward_list b = {1.0, 2.0, 3.0, 4.0, 4.0, 5.0}; + + a.merge(std::move(b)); + + std::forward_list r = {0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, + 4.0, 4.0, 4.0, 5.0}; + + VERIFY(a == r); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/6.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/6.cc new file mode 100644 index 000000000..082d2adbb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/6.cc @@ -0,0 +1,83 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +bool test __attribute__((unused)) = true; + +// Comparison functor. +template + class Comp + { + public: + Comp(const Num & num) + { + n = num; + } + bool operator()(const Num i, const Num j) + { + return (n * i) < (n * j); + } + private: + Num n; + }; + +// This test verifies the following: +// +void +test01() +{ + const unsigned int n = 13; + int order[][n] = { + { 0,1,2,3,4,5,6,7,8,9,10,11,12 }, + { 6,2,8,4,11,1,12,7,3,9,5,0,10 }, + { 12,11,10,9,8,7,6,5,4,3,2,1,0 }, + }; + std::forward_list sorted(order[0], order[0] + n); + + for (unsigned int i = 0; i < sizeof(order)/sizeof(*order); ++i) + { + std::forward_list head(order[i], order[i] + n); + + head.sort(); + + VERIFY(head == sorted); + } + + std::forward_list reversed(order[2], order[2] + n); + for (unsigned int i = 0; i < sizeof(order)/sizeof(*order); ++i) + { + std::forward_list head(order[i], order[i] + n); + + Comp comp(-1); + head.sort( comp ); + + VERIFY(head == reversed); + } +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/7.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/7.cc new file mode 100644 index 000000000..fd71cb631 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/7.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + +// 23.2.3.n forward_list xxx [lib.forward_list.xxx] + +#include +#include + +#include + +bool test __attribute__((unused)) = true; + +// This test verifies the following: +// +void +test01() +{ + const unsigned int n = 13; + int order[n] = {0,1,2,3,4,5,6,7,8,9,10,11,12}; + + std::forward_list fl(order, order + n); + + std::forward_list fl2; + for (std::size_t i = 0; i < n; ++i) + fl2.push_front(order[i]); + + fl.reverse(); + + VERIFY(std::lexicographical_compare(fl.begin(), fl.end(), + fl2.begin(), fl2.end()) == false); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/remove_freed.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/remove_freed.cc new file mode 100644 index 000000000..5b9592092 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/remove_freed.cc @@ -0,0 +1,94 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-08-11 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 + +// 23.3.3.5 forward_list operations [forwardlist.ops] + +// Used to cause many Valgrind errors: LWG 526-type situation. +void test01() +{ + bool test __attribute__((unused)) = true; + + std::forward_list fl1; + + fl1.push_front(1); + fl1.push_front(2); + fl1.push_front(3); + fl1.push_front(4); + fl1.push_front(1); + + fl1.remove(*fl1.begin()); + + VERIFY( std::distance(fl1.begin(), fl1.end()) == 3 ); + + auto it1 = fl1.begin(); + + VERIFY( *it1 == 4 ); + ++it1; + VERIFY( *it1 == 3 ); + ++it1; + VERIFY( *it1 == 2 ); + + std::forward_list fl2; + + fl2.push_front(3); + fl2.push_front(3); + fl2.push_front(3); + fl2.push_front(3); + fl2.push_front(3); + + auto it2 = fl2.begin(); + ++it2; + ++it2; + + fl2.remove(*it2); + + VERIFY( std::distance(fl2.begin(), fl2.end()) == 0 ); + + std::forward_list fl3; + + fl3.push_front(1); + fl3.push_front(2); + fl3.push_front(3); + fl3.push_front(3); + fl3.push_front(3); + + auto it3 = fl3.begin(); + ++it3; + ++it3; + + fl3.remove(*it3); + + VERIFY( std::distance(fl3.begin(), fl3.end()) == 2 ); + + it3 = fl3.begin(); + VERIFY( *it3 == 2 ); + ++it3; + VERIFY( *it3 == 1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/range_access.cc b/libstdc++-v3/testsuite/23_containers/forward_list/range_access.cc new file mode 100644 index 000000000..350b8286c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/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::forward_list fl{1, 2, 3}; + std::begin(fl); + std::end(fl); +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/citerators.cc new file mode 100644 index 000000000..86fa26e31 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/citerators.cc @@ -0,0 +1,41 @@ +// { 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 +// . + +#include +#include + +namespace __gnu_test +{ + template<> + struct populate, true> + { + populate(std::forward_list& container) + { + container.push_front(1); + container.push_front(2); + } + }; +} + +int main() +{ + typedef std::forward_list test_type; + __gnu_test::citerator test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc new file mode 100644 index 000000000..e87fa60c3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-error "no matching" "" { target *-*-* } 1206 } +// { dg-excess-errors "" } + +// Copyright (C) 2009, 2010 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// 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 + +struct A +{ + explicit A(int) { } +}; + +void f() +{ + typedef std::forward_list test_type; + test_type l; + l.assign(10, 1); +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor.cc new file mode 100644 index 000000000..407d8d169 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor.cc @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 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 + +void f() +{ + typedef std::forward_list test_type; + test_type l(10, 1); +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc new file mode 100644 index 000000000..5da159c13 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-error "no matching" "" { target *-*-* } 1206 } +// { dg-excess-errors "" } + +// Copyright (C) 2009, 2010, 2011 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 + +void f() +{ + typedef std::forward_list > test_type; + test_type l(10, 1); +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc new file mode 100644 index 000000000..785fe5136 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc @@ -0,0 +1,30 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-error "no matching" "" { target *-*-* } 1206 } +// { dg-excess-errors "" } + +// Copyright (C) 2009, 2010, 2011 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 + +void f() +{ + typedef std::forward_list > > test_type; + test_type l('a', 'b'); +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc new file mode 100644 index 000000000..aabc8b8f7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-error "no matching" "" { target *-*-* } 1206 } +// { dg-excess-errors "" } + +// Copyright (C) 2009, 2010, 2011 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 + +struct A +{ + explicit A(int) { } +}; + +void f() +{ + typedef std::forward_list test_type; + test_type l; + l.insert_after(l.begin(), 10, 1); +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/basic.cc new file mode 100644 index 000000000..672daf840 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/basic.cc @@ -0,0 +1,40 @@ +// { 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::forward_list 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/forward_list/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/generation_prohibited.cc new file mode 100644 index 000000000..7d1764799 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/generation_prohibited.cc @@ -0,0 +1,34 @@ +// { 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::forward_list test_type; + __gnu_test::generation_prohibited test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/propagation_consistent.cc new file mode 100644 index 000000000..5c426c93c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/exception/propagation_consistent.cc @@ -0,0 +1,34 @@ +// { 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::forward_list test_type; + __gnu_test::propagation_consistent test; + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/1.cc new file mode 100644 index 000000000..d2d89772c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/1.cc @@ -0,0 +1,27 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + + +// This file tests explicit instantiation of library containers + +#include + +// { dg-do compile } + +template class std::forward_list; diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/3.cc new file mode 100644 index 000000000..f16650ae9 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/3.cc @@ -0,0 +1,28 @@ +// { dg-options "-std=gnu++0x" } + +// 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 +// . + + +// This file tests explicit instantiation of library containers + +#include + +// { dg-do compile } + +// libstdc++/21770 +template class std::forward_list >; diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/4.cc new file mode 100644 index 000000000..11f15248f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/4.cc @@ -0,0 +1,32 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-05-20 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 +// . + + +// This file tests explicit instantiation of library containers + +#include +#include +#include + +// { dg-do compile } + +// libstdc++/41792 +template class std::forward_list<__gnu_test::OverloadedAddress>; diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/typedefs.cc new file mode 100644 index 000000000..3497b09de --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/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