diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-25 22:29:08 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-25 22:29:08 +0000 |
commit | 43308b7e11b2c491063a4670effa18588b07037f (patch) | |
tree | 57b49f93cf285f8979379f2249d8b9a3d4bcb0e0 /libstdc++-v3/testsuite | |
parent | 31c1975b01f8fc172a444b3395250e33396e0def (diff) | |
download | gcc-43308b7e11b2c491063a4670effa18588b07037f.tar.gz |
2009-08-25 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/basic_string.h (basic_string): Add cbegin(),
cend(), crbegin(), crend() in C++0x mode.
* config/abi/pre/gnu.ver: Add exports.
* testsuite/util/testsuite_containers.h: New.
* testsuite/util/testsuite_container_traits.h: New.
* testsuite/21_strings/basic_string/requirements/citerators.cc: New.
* testsuite/21_strings/basic_string/requirements/typedefs.cc: New.
* testsuite/ext/vstring/requirements/citerators.cc: Edit.
* testsuite/ext/vstring/requirements/typedefs.cc: New.
* testsuite/23_containers/unordered_map/requirements/
cliterators.cc: Edit.
* testsuite/23_containers/unordered_map/requirements/
citerators.cc: Edit.
* testsuite/23_containers/unordered_map/requirements/
explicit_instantiation/1.cc: New.
* testsuite/23_containers/unordered_map/requirements/
explicit_instantiation/2.cc: New.
* testsuite/23_containers/unordered_map/requirements/
explicit_instantiation/3.cc: New.
* testsuite/23_containers/unordered_map/requirements/typedefs.cc: Edit.
* testsuite/23_containers/unordered_map/requirements/
explicit_instantiation.cc: Move to nested directory.
* testsuite/23_containers/queue/requirements/typedefs.cc: New.
* testsuite/23_containers/priority_queue/requirements/typedefs.cc: New.
* testsuite/23_containers/multimap/requirements/citerators.cc: Edit.
* testsuite/23_containers/multimap/requirements/typedefs.cc: New.
* testsuite/23_containers/set/requirements/citerators.cc: Edit.
* testsuite/23_containers/set/requirements/typedefs.cc: New.
* testsuite/23_containers/unordered_multimap/requirements/
cliterators.cc: Edit.
* testsuite/23_containers/unordered_multimap/requirements/
citerators.cc: Edit.
* testsuite/23_containers/unordered_multimap/requirements/
explicit_instantiation/1.cc: New.
* testsuite/23_containers/unordered_multimap/requirements/
explicit_instantiation/2.cc: Edit.: New.
* testsuite/23_containers/unordered_multimap/requirements/
explicit_instantiation/3.cc: New.
* testsuite/23_containers/unordered_multimap/requirements/
typedefs.cc: Edit.
* testsuite/23_containers/unordered_multimap/requirements/
explicit_instantiation.cc: Move to nested.
* testsuite/23_containers/forward_list/requirements/citerators.cc: New.
* testsuite/23_containers/forward_list/requirements/1.cc: Remove.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: New.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: New.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: New.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: New.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor.cc: New.
* testsuite/23_containers/forward_list/requirements/typedefs.cc: New.
* testsuite/23_containers/unordered_set/requirements/
cliterators.cc: Edit.
* testsuite/23_containers/unordered_set/requirements/
citerators.cc: Edit.
* testsuite/23_containers/unordered_set/requirements/
explicit_instantiation/1.cc: New.
* testsuite/23_containers/unordered_set/requirements/
explicit_instantiation/2.cc: New.
* testsuite/23_containers/unordered_set/requirements/
explicit_instantiation/3.cc: New.
* testsuite/23_containers/unordered_set/requirements/typedefs.cc: Edit.
* testsuite/23_containers/unordered_set/requirements/
explicit_instantiation.cc: Move to nested.
* testsuite/23_containers/vector/requirements/citerators.cc: Edit.
* testsuite/23_containers/vector/requirements/dr438/bool/
constructor.cc: Move.
* testsuite/23_containers/vector/requirements/typedefs.cc: New.
* testsuite/23_containers/vector/bool/requirements/citerators.cc: Edit.
* testsuite/23_containers/vector/bool/requirements/dr438/
constructor.cc: New.
* testsuite/23_containers/deque/requirements/citerators.cc: Edit.
* testsuite/23_containers/deque/requirements/typedefs.cc
* testsuite/23_containers/stack/requirements/typedefs.cc
* testsuite/23_containers/multiset/requirements/citerators.cc: Edit.
* testsuite/23_containers/multiset/requirements/typedefs.cc: New.
* testsuite/23_containers/list/requirements/citerators.cc: Edit.
* testsuite/23_containers/list/requirements/typedefs.cc: New.
* testsuite/23_containers/unordered_multiset/requirements/
cliterators.cc: Edit.
* testsuite/23_containers/unordered_multiset/requirements/
citerators.cc: Edit.
* testsuite/23_containers/unordered_multiset/requirements/
explicit_instantiation.cc: Move.
* testsuite/23_containers/unordered_multiset/requirements/
explicit_instantiation/1.cc: New.
* testsuite/23_containers/unordered_multiset/requirements/
explicit_instantiation/2.cc: New.
* testsuite/23_containers/unordered_multiset/requirements/
explicit_instantiation/3.cc: New.
* testsuite/23_containers/unordered_multiset/requirements/typedefs.cc
* testsuite/23_containers/map/requirements/citerators.cc: Edit.
* testsuite/23_containers/map/requirements/typedefs.cc: New.
* testsuite/23_containers/array/requirements/citerators.cc: Edit.
* testsuite/23_containers/array/requirements/explicit_instantiation.cc:
Move.
* testsuite/23_containers/array/requirements/
explicit_instantiation/1.cc: New.
* testsuite/23_containers/array/requirements/
explicit_instantiation/2.cc: New.
* testsuite/23_containers/array/requirements/typedefs.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151106 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
61 files changed, 1338 insertions, 478 deletions
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/citerators.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/citerators.cc new file mode 100644 index 00000000000..fe262b0986a --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/citerators.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-string-conversions "" } + +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <string> +#include <testsuite_containers.h> + +int main() +{ + __gnu_test::citerator<std::string> test1; + __gnu_test::citerator<std::wstring> test2; + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/typedefs.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/typedefs.cc new file mode 100644 index 00000000000..aa0ac08742b --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/typedefs.cc @@ -0,0 +1,26 @@ +// { 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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <string> + +// Check container for required typedefs. +__gnu_test::types<std::string> t1; +__gnu_test::types<std::wstring> t2; diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc index 0597dcfc5ff..c448a8419ec 100644 --- a/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc @@ -19,26 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <array> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::array<int, 7> a; - VERIFY( a.cbegin() == a.begin() ); - VERIFY( a.cend() == a.end() ); - VERIFY( a.crbegin() == a.rbegin() ); - VERIFY( a.crend() == a.rend() ); - VERIFY( a.cbegin() != a.cend() ); - VERIFY( a.crbegin() != a.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::array<int, 7> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/1.cc index 75fcb3cddaf..0e104412416 100644 --- a/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/1.cc @@ -18,7 +18,6 @@ // along with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <array> template class std::array<int, 5>; diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..aadf76b7223 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/2.cc @@ -0,0 +1,27 @@ +// { 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 +// <http://www.gnu.org/licenses/>. + +// This file tests explicit instantiation of library containers + +#include <array> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +template class std::array<__gnu_test::NonDefaultConstructible, 3>; diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/typedefs.cc new file mode 100644 index 00000000000..152988df76f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/array/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <array> + +// Check container for required typedefs. +__gnu_test::types<std::array<int, 10> > t; diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc index dd4179da906..4a05e606010 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc @@ -19,26 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <deque> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::deque<int> d(7); - VERIFY( d.cbegin() == d.begin() ); - VERIFY( d.cend() == d.end() ); - VERIFY( d.crbegin() == d.rbegin() ); - VERIFY( d.crend() == d.rend() ); - VERIFY( d.cbegin() != d.cend() ); - VERIFY( d.crbegin() != d.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::deque<int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/typedefs.cc new file mode 100644 index 00000000000..6263951fed7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <deque> + +// Check container for required typedefs. +__gnu_test::types<std::deque<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/1.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/1.cc deleted file mode 100644 index 67aa70bccb8..00000000000 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/1.cc +++ /dev/null @@ -1,69 +0,0 @@ -// { 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 Pred the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// <http://www.gnu.org/licenses/>. - -// 23.2.3.n forward_list xxx [lib.forward_list.xxx] - -#include <forward_list> -#include <testsuite_hooks.h> - -bool test __attribute__((unused)) = true; - -// A nontrivial type. -template<typename T> - struct A { }; - -// Another nontrivial type -struct B { }; - -// A nontrivial type convertible from an int -struct C -{ - C(int i) : i_(i) { } - bool operator==(const C& rhs) { return i_ == rhs.i_; } - int i_; -}; - -// This test verifies the following. -// -void -test01() -{ - std::forward_list< A<B> > lst; - VERIFY(lst.begin() == lst.end()); - VERIFY(std::distance(lst.begin(), lst.end()) == 0); - - // check type definitions -- will fail compile if missing - typedef std::forward_list< A<B> >::reference reference; - typedef std::forward_list< A<B> >::const_reference const_reference; - typedef std::forward_list< A<B> >::iterator iterator; - typedef std::forward_list< A<B> >::const_iterator const_iterator; - typedef std::forward_list< A<B> >::size_type size_type; - typedef std::forward_list< A<B> >::difference_type difference_type; - typedef std::forward_list< A<B> >::value_type value_type; - typedef std::forward_list< A<B> >::allocator_type allocator_type; - typedef std::forward_list< A<B> >::pointer pointer; - typedef std::forward_list< A<B> >::const_pointer const_pointer; -} - -int -main() -{ - test01(); - return 0; -} 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 00000000000..86fa26e3198 --- /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 +// <http://www.gnu.org/licenses/>. + +#include <forward_list> +#include <testsuite_containers.h> + +namespace __gnu_test +{ + template<> + struct populate<std::forward_list<int>, true> + { + populate(std::forward_list<int>& container) + { + container.push_front(1); + container.push_front(2); + } + }; +} + +int main() +{ + typedef std::forward_list<int> test_type; + __gnu_test::citerator<test_type> 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 00000000000..93f0e6d591d --- /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 *-*-* } 1209 } +// { dg-excess-errors "" } + +// 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 +// <http://www.gnu.org/licenses/>. + +#include <forward_list> + +struct A +{ + explicit A(int) { } +}; + +void f() +{ + typedef std::forward_list<A> 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 00000000000..407d8d16942 --- /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 +// <http://www.gnu.org/licenses/>. + +#include <forward_list> + +void f() +{ + typedef std::forward_list<int> 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 00000000000..70d0447a5d6 --- /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 *-*-* } 1209 } +// { dg-excess-errors "" } + +// 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 +// <http://www.gnu.org/licenses/>. + +#include <forward_list> + +void f() +{ + typedef std::forward_list<std::forward_list<int> > 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 00000000000..2ee8b9f6baf --- /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 *-*-* } 1209 } +// { dg-excess-errors "" } + +// 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 +// <http://www.gnu.org/licenses/>. + +#include <forward_list> +#include <utility> + +void f() +{ + typedef std::forward_list<std::forward_list<std::pair<char, char> > > 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 00000000000..a21c22242b3 --- /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 *-*-* } 1209 } +// { dg-excess-errors "" } + +// 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 +// <http://www.gnu.org/licenses/>. + +#include <forward_list> + +struct A +{ + explicit A(int) { } +}; + +void f() +{ + typedef std::forward_list<A> test_type; + test_type l; + l.insert_after(l.begin(), 10, 1); +} 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 00000000000..3497b09de7c --- /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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <forward_list> + +// Check container for required typedefs. +__gnu_test::types<std::forward_list<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc index 6bcffbb05ee..ac5bdec983a 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc @@ -19,28 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <list> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - typedef std::list<int> list_type; - list_type l(7); - - VERIFY( l.cbegin() == l.begin() ); - VERIFY( l.cend() == l.end() ); - VERIFY( l.crbegin() == l.rbegin() ); - VERIFY( l.crend() == l.rend() ); - VERIFY( l.cbegin() != l.cend() ); - VERIFY( l.crbegin() != l.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::list<int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/typedefs.cc new file mode 100644 index 00000000000..444ebb540a5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <list> + +// Check container for required typedefs. +__gnu_test::types<std::list<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc index 05e10aad2a6..17db1e7da38 100644 --- a/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc @@ -19,27 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <map> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::map<int, int> m; - m[1] = 1; - VERIFY( m.cbegin() == m.begin() ); - VERIFY( m.cend() == m.end() ); - VERIFY( m.crbegin() == m.rbegin() ); - VERIFY( m.crend() == m.rend() ); - VERIFY( m.cbegin() != m.cend() ); - VERIFY( m.crbegin() != m.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::map<int, int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/map/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/map/requirements/typedefs.cc new file mode 100644 index 00000000000..1325cc607de --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <map> + +// Check container for required typedefs. +__gnu_test::types<std::map<int, long> > t; diff --git a/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc index 2daa88564cc..15773cb5126 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc @@ -19,28 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <map> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - typedef std::multimap<int, int> mm_type; - mm_type mm; - mm.insert(mm_type::value_type(1, 1)); - VERIFY( mm.cbegin() == mm.begin() ); - VERIFY( mm.cend() == mm.end() ); - VERIFY( mm.crbegin() == mm.rbegin() ); - VERIFY( mm.crend() == mm.rend() ); - VERIFY( mm.cbegin() != mm.cend() ); - VERIFY( mm.crbegin() != mm.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::multimap<int, int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/multimap/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/multimap/requirements/typedefs.cc new file mode 100644 index 00000000000..38a4bc5358c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <map> + +// Check container for required typedefs. +__gnu_test::types<std::multimap<int, long> > t; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc index 2efd054f62a..bf3aa16447c 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc @@ -19,27 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <set> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::multiset<int> ms; - ms.insert(1); - VERIFY( ms.cbegin() == ms.begin() ); - VERIFY( ms.cend() == ms.end() ); - VERIFY( ms.crbegin() == ms.rbegin() ); - VERIFY( ms.crend() == ms.rend() ); - VERIFY( ms.cbegin() != ms.cend() ); - VERIFY( ms.crbegin() != ms.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::multiset<int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/typedefs.cc new file mode 100644 index 00000000000..7244003c282 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/typedefs.cc @@ -0,0 +1,25 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <set> + +// Check container for required typedefs. +__gnu_test::types<std::multiset<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/typedefs.cc new file mode 100644 index 00000000000..86fcb0c1337 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/priority_queue/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <queue> + +// Check container for required typedefs. +__gnu_test::types<std::priority_queue<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/queue/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/queue/requirements/typedefs.cc new file mode 100644 index 00000000000..7563a2cc937 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/queue/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <queue> + +// Check container for required typedefs. +__gnu_test::types<std::queue<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc index d2cfd4c9165..20dd8b9f1e4 100644 --- a/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc @@ -19,27 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <set> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::set<int> s; - s.insert(1); - VERIFY( s.cbegin() == s.begin() ); - VERIFY( s.cend() == s.end() ); - VERIFY( s.crbegin() == s.rbegin() ); - VERIFY( s.crend() == s.rend() ); - VERIFY( s.cbegin() != s.cend() ); - VERIFY( s.crbegin() != s.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::set<int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc new file mode 100644 index 00000000000..0581e49ecbe --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc @@ -0,0 +1,25 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <set> + +// Check container for required typedefs. +__gnu_test::types<std::set<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/stack/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/stack/requirements/typedefs.cc new file mode 100644 index 00000000000..d0f56e5d60c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/stack/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <stack> + +// Check container for required typedefs. +__gnu_test::types<std::stack<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc index b8f9d502a0d..a00635a568f 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc @@ -19,24 +19,13 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <unordered_map> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::unordered_map<int, int> um; - um[1] = 1; - VERIFY( um.cbegin() == um.begin() ); - VERIFY( um.cend() == um.end() ); - VERIFY( um.cbegin() != um.cend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::unordered_map<int, int> test_type; + __gnu_test::citerator<test_type> test; return 0; } + diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc index a6729a314be..3cad0a16a06 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc @@ -19,26 +19,14 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <unordered_map> -#include <testsuite_hooks.h> - -// DR 691. -void test01() -{ - bool test __attribute__((unused)) = true; - - typedef std::unordered_map<int, int> um_type; - um_type um; - um[1] = 1; - VERIFY( um.cbegin(0) == um.begin(0) ); - VERIFY( um.cend(0) == um.end(0) ); - const um_type::size_type bn = um.bucket(1); - VERIFY( um.cbegin(bn) != um.cend(bn) ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::unordered_map<int, int> test_type; + typedef typename test_type::value_type value_type; + value_type v(1, 1); + __gnu_test::forward_members_unordered<test_type> test(v); return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/1.cc index 9027fdcc144..9027fdcc144 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/1.cc diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..f6b5fe37274 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/2.cc @@ -0,0 +1,28 @@ +// { 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 +// <http://www.gnu.org/licenses/>. + +// This file tests explicit instantiation of library containers + +#include <unordered_map> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +typedef __gnu_test::NonDefaultConstructible inst_type; +template class std::unordered_map<inst_type, inst_type>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc new file mode 100644 index 00000000000..695fa6f58e3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc @@ -0,0 +1,24 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <unordered_map> + +using namespace std; +template class unordered_map<int, int, hash<int>, equal_to<int>, allocator<char>>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/typedefs.cc index 6985a9b565b..9b978cebc20 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/typedefs.cc @@ -1,9 +1,7 @@ -// { dg-do compile } // { dg-options "-std=gnu++0x" } +// { dg-do compile } -// 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com> - -// Copyright (C) 2008, 2009 Free Software Foundation +// 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 @@ -20,27 +18,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. +#include <testsuite_containers.h> #include <unordered_map> -void test01() -{ - // Check for required typedefs - typedef std::unordered_map<int, int> test_type; - - typedef test_type::key_type key_type; - typedef test_type::value_type value_type; - typedef test_type::mapped_type mapped_type; - typedef test_type::hasher hasher; - typedef test_type::key_equal key_equal; - typedef test_type::allocator_type allocator_type; - typedef test_type::pointer pointer; - typedef test_type::const_pointer const_pointer; - typedef test_type::reference reference; - typedef test_type::const_reference const_reference; - typedef test_type::size_type size_type; - typedef test_type::difference_type difference_type; - typedef test_type::iterator iterator; - typedef test_type::const_iterator const_iterator; - typedef test_type::local_iterator local_iterator; - typedef test_type::const_local_iterator const_local_iterator; -} +// Check container for required typedefs. +__gnu_test::types<std::unordered_map<int, long> > t; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc index dec0f50027a..736220b73bf 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc @@ -19,25 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <unordered_map> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - typedef std::unordered_multimap<int, int> umm_type; - umm_type umm; - umm.insert(umm_type::value_type(1, 1)); - VERIFY( umm.cbegin() == umm.begin() ); - VERIFY( umm.cend() == umm.end() ); - VERIFY( umm.cbegin() != umm.cend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::unordered_multimap<int, int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc index d764369bf41..612787cc763 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc @@ -19,26 +19,14 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <unordered_map> -#include <testsuite_hooks.h> - -// DR 691. -void test01() -{ - bool test __attribute__((unused)) = true; - - typedef std::unordered_multimap<int, int> umm_type; - umm_type umm; - umm.insert(umm_type::value_type(1, 1)); - VERIFY( umm.cbegin(0) == umm.begin(0) ); - VERIFY( umm.cend(0) == umm.end(0) ); - const umm_type::size_type bn = umm.bucket(1); - VERIFY( umm.cbegin(bn) != umm.cend(bn) ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::unordered_multimap<int, int> test_type; + typedef typename test_type::value_type value_type; + value_type v(1, 1); + __gnu_test::forward_members_unordered<test_type> test(v); return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/1.cc index 863562db855..863562db855 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/1.cc diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..e26428dd698 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/2.cc @@ -0,0 +1,28 @@ +// { 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 +// <http://www.gnu.org/licenses/>. + +// This file tests explicit instantiation of library containers + +#include <unordered_map> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +typedef __gnu_test::NonDefaultConstructible inst_type; +template class std::unordered_multimap<inst_type, inst_type>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc new file mode 100644 index 00000000000..5085f611071 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc @@ -0,0 +1,24 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <unordered_map> + +using namespace std; +template class unordered_multimap<int, int, hash<int>, equal_to<int>, allocator<char>>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/typedefs.cc index e272e19f2d0..eb1b9157a5c 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/typedefs.cc @@ -1,9 +1,7 @@ -// { dg-do compile } // { dg-options "-std=gnu++0x" } +// { dg-do compile } -// 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com> - -// Copyright (C) 2008, 2009 Free Software Foundation +// 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 @@ -20,27 +18,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. +#include <testsuite_containers.h> #include <unordered_map> -void test01() -{ - // Check for required typedefs - typedef std::unordered_multimap<int, int> test_type; - - typedef test_type::key_type key_type; - typedef test_type::value_type value_type; - typedef test_type::mapped_type mapped_type; - typedef test_type::hasher hasher; - typedef test_type::key_equal key_equal; - typedef test_type::allocator_type allocator_type; - typedef test_type::pointer pointer; - typedef test_type::const_pointer const_pointer; - typedef test_type::reference reference; - typedef test_type::const_reference const_reference; - typedef test_type::size_type size_type; - typedef test_type::difference_type difference_type; - typedef test_type::iterator iterator; - typedef test_type::const_iterator const_iterator; - typedef test_type::local_iterator local_iterator; - typedef test_type::const_local_iterator const_local_iterator; -} +// Check container for required typedefs. +__gnu_test::types<std::unordered_multimap<int, long> > t; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc index 0db11958d2e..6731848fe6c 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc @@ -19,24 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <unordered_set> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::unordered_multiset<int> ums; - ums.insert(1); - VERIFY( ums.cbegin() == ums.begin() ); - VERIFY( ums.cend() == ums.end() ); - VERIFY( ums.cbegin() != ums.cend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::unordered_multiset<int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc index ccaf1b677bf..c9db47ce500 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc @@ -19,26 +19,14 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <unordered_set> -#include <testsuite_hooks.h> - -// DR 691. -void test01() -{ - bool test __attribute__((unused)) = true; - - typedef std::unordered_multiset<int> ums_type; - ums_type ums; - ums.insert(1); - VERIFY( ums.cbegin(0) == ums.begin(0) ); - VERIFY( ums.cend(0) == ums.end(0) ); - const ums_type::size_type bn = ums.bucket(1); - VERIFY( ums.cbegin(bn) != ums.cend(bn) ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::unordered_multiset<int> test_type; + typedef typename test_type::value_type value_type; + value_type v(1); + __gnu_test::forward_members_unordered<test_type> test(v); return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/1.cc index a8fbbd081b5..a8fbbd081b5 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/1.cc diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..d2a120a533e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/2.cc @@ -0,0 +1,27 @@ +// { 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 +// <http://www.gnu.org/licenses/>. + +// This file tests explicit instantiation of library containers + +#include <unordered_set> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +template class std::unordered_multiset<__gnu_test::NonDefaultConstructible>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc new file mode 100644 index 00000000000..faf119ca26e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc @@ -0,0 +1,24 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> + +using namespace std; +template class unordered_multiset<int, hash<int>, equal_to<int>, allocator<char>>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/typedefs.cc index edd47a325f6..7e65e3a214c 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/typedefs.cc @@ -1,9 +1,7 @@ -// { dg-do compile } // { dg-options "-std=gnu++0x" } +// { dg-do compile } -// 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com> - -// Copyright (C) 2008, 2009 Free Software Foundation +// 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 @@ -20,26 +18,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. +#include <testsuite_containers.h> #include <unordered_set> -void test01() -{ - // Check for required typedefs - typedef std::unordered_multiset<int> test_type; - - typedef test_type::key_type key_type; - typedef test_type::value_type value_type; - typedef test_type::hasher hasher; - typedef test_type::key_equal key_equal; - typedef test_type::allocator_type allocator_type; - typedef test_type::pointer pointer; - typedef test_type::const_pointer const_pointer; - typedef test_type::reference reference; - typedef test_type::const_reference const_reference; - typedef test_type::size_type size_type; - typedef test_type::difference_type difference_type; - typedef test_type::iterator iterator; - typedef test_type::const_iterator const_iterator; - typedef test_type::local_iterator local_iterator; - typedef test_type::const_local_iterator const_local_iterator; -} +// Check container for required typedefs. +__gnu_test::types<std::unordered_multiset<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc index 765d99cbf61..ce7f79fd69d 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc @@ -19,24 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <unordered_set> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::unordered_set<int> us; - us.insert(1); - VERIFY( us.cbegin() == us.begin() ); - VERIFY( us.cend() == us.end() ); - VERIFY( us.cbegin() != us.cend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::unordered_set<int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc index ef356b6ddbd..8abef8c1c9a 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc @@ -19,26 +19,14 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <unordered_set> -#include <testsuite_hooks.h> - -// DR 691. -void test01() -{ - bool test __attribute__((unused)) = true; - - typedef std::unordered_set<int> us_type; - us_type us; - us.insert(1); - VERIFY( us.cbegin(0) == us.begin(0) ); - VERIFY( us.cend(0) == us.end(0) ); - const us_type::size_type bn = us.bucket(1); - VERIFY( us.cbegin(bn) != us.cend(bn) ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::unordered_set<int> test_type; + typedef typename test_type::value_type value_type; + value_type v(1); + __gnu_test::forward_members_unordered<test_type> test(v); return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/1.cc index 10d0bf5667d..10d0bf5667d 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/1.cc diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..13e9e37c3dd --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/2.cc @@ -0,0 +1,27 @@ +// { 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 +// <http://www.gnu.org/licenses/>. + +// This file tests explicit instantiation of library containers + +#include <unordered_set> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +template class std::unordered_set<__gnu_test::NonDefaultConstructible>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc new file mode 100644 index 00000000000..7d84ffd7fdc --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc @@ -0,0 +1,24 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <unordered_set> + +using namespace std; +template class unordered_set<int, hash<int>, equal_to<int>, allocator<char>>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/typedefs.cc index 4ebcb539029..86983e5a611 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/typedefs.cc @@ -1,9 +1,7 @@ -// { dg-do compile } // { dg-options "-std=gnu++0x" } +// { dg-do compile } -// 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com> - -// Copyright (C) 2008, 2009 Free Software Foundation +// 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 @@ -20,26 +18,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. +#include <testsuite_containers.h> #include <unordered_set> -void test01() -{ - // Check for required typedefs - typedef std::unordered_set<int> test_type; - - typedef test_type::key_type key_type; - typedef test_type::value_type value_type; - typedef test_type::hasher hasher; - typedef test_type::key_equal key_equal; - typedef test_type::allocator_type allocator_type; - typedef test_type::pointer pointer; - typedef test_type::const_pointer const_pointer; - typedef test_type::reference reference; - typedef test_type::const_reference const_reference; - typedef test_type::size_type size_type; - typedef test_type::difference_type difference_type; - typedef test_type::iterator iterator; - typedef test_type::const_iterator const_iterator; - typedef test_type::local_iterator local_iterator; - typedef test_type::const_local_iterator const_local_iterator; -} +// Check container for required typedefs. +__gnu_test::types<std::unordered_set<int> > t; diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc index b5eaebb6525..9f4783b7439 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc @@ -19,26 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <vector> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::vector<bool> vb(7); - VERIFY( vb.cbegin() == vb.begin() ); - VERIFY( vb.cend() == vb.end() ); - VERIFY( vb.crbegin() == vb.rbegin() ); - VERIFY( vb.crend() == vb.rend() ); - VERIFY( vb.cbegin() != vb.cend() ); - VERIFY( vb.crbegin() != vb.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::vector<bool> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/bool/constructor.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/dr438/constructor.cc index 9a815ec7dec..9a815ec7dec 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/bool/constructor.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/dr438/constructor.cc diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc index c9a07a1ed75..eee16b04ed6 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc @@ -19,26 +19,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <vector> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - std::vector<int> v(7); - VERIFY( v.cbegin() == v.begin() ); - VERIFY( v.cend() == v.end() ); - VERIFY( v.crbegin() == v.rbegin() ); - VERIFY( v.crend() == v.rend() ); - VERIFY( v.cbegin() != v.cend() ); - VERIFY( v.crbegin() != v.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef std::vector<int> test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/typedefs.cc new file mode 100644 index 00000000000..24897ff3aea --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <vector> + +// Check container for required typedefs. +__gnu_test::types<std::vector<int> > t; diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc index 125cefd7109..582cadac338 100644 --- a/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc +++ b/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc @@ -20,26 +20,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <ext/vstring.h> -#include <testsuite_hooks.h> - -void -test01() -{ - bool test __attribute__((unused)) = true; - - __gnu_cxx::__vstring v(7, 'a'); - VERIFY( v.cbegin() == v.begin() ); - VERIFY( v.cend() == v.end() ); - VERIFY( v.crbegin() == v.rbegin() ); - VERIFY( v.crend() == v.rend() ); - VERIFY( v.cbegin() != v.cend() ); - VERIFY( v.crbegin() != v.crend() ); -} +#include <testsuite_containers.h> int main() { - test01(); + typedef __gnu_cxx::__vstring test_type; + __gnu_test::citerator<test_type> test; return 0; } diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/typedefs.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/typedefs.cc new file mode 100644 index 00000000000..06db6afc32a --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/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 +// <http://www.gnu.org/licenses/>. + +#include <testsuite_containers.h> +#include <ext/vstring.h> + +// Check container for required typedefs. +__gnu_test::types<__gnu_cxx::__vstring> t; diff --git a/libstdc++-v3/testsuite/util/testsuite_container_traits.h b/libstdc++-v3/testsuite/util/testsuite_container_traits.h new file mode 100644 index 00000000000..7c4b1a27097 --- /dev/null +++ b/libstdc++-v3/testsuite/util/testsuite_container_traits.h @@ -0,0 +1,207 @@ +// -*- C++ -*- + +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#ifndef _GLIBCXX_TESTSUITE_CONTAINER_TRAITS_H +#define _GLIBCXX_TESTSUITE_CONTAINER_TRAITS_H + +#include <bits/stdc++.h> +#include <ext/vstring.h> + +namespace __gnu_test +{ + // Container traits. + struct traits_base + { + // Type, nested type, and typedef related traits. + typedef std::false_type is_container; + typedef std::false_type is_adaptor; + typedef std::false_type is_reversible; + typedef std::false_type is_allocator_aware; + typedef std::false_type is_pointer_aware; + typedef std::false_type is_associative; + typedef std::false_type is_unordered; + typedef std::false_type is_mapped; + }; + + // Primary template does nothing. Specialize on each type under + // test, derive off of traits_base and just add the true traits. + template<typename _Tp> + struct traits; + + // Specialize for each container. + template<typename _Tp, size_t _Np> + struct traits<std::array<_Tp, _Np> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + }; + + template<typename _Tp> + struct traits<std::deque<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + }; + + template<typename _Tp> + struct traits<std::forward_list<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + }; + + template<typename _Tp> + struct traits<std::list<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + }; + + template<typename _Kp, typename _Tp> + struct traits<std::map<_Kp, _Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + typedef std::true_type is_associative; + typedef std::true_type is_mapped; + }; + + template<typename _Kp, typename _Tp> + struct traits<std::multimap<_Kp, _Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + typedef std::true_type is_associative; + typedef std::true_type is_mapped; + }; + + template<typename _Tp> + struct traits<std::multiset<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + typedef std::true_type is_associative; + }; + + template<typename _Tp> + struct traits<std::priority_queue<_Tp> > : public traits_base + { + typedef std::true_type is_adaptor; + }; + + template<typename _Tp> + struct traits<std::queue<_Tp> > : public traits_base + { + typedef std::true_type is_adaptor; + }; + + template<typename _Tp> + struct traits<std::set<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + typedef std::true_type is_associative; + }; + + template<typename _Tp> + struct traits<std::stack<_Tp> > : public traits_base + { + typedef std::true_type is_adaptor; + }; + + template<typename _Kp, typename _Tp> + struct traits<std::unordered_map<_Kp, _Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + typedef std::true_type is_unordered; + typedef std::true_type is_mapped; + }; + + template<typename _Kp, typename _Tp> + struct traits<std::unordered_multimap<_Kp, _Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + typedef std::true_type is_unordered; + typedef std::true_type is_mapped; + }; + + template<typename _Tp> + struct traits<std::unordered_multiset<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + typedef std::true_type is_unordered; + }; + + template<typename _Tp> + struct traits<std::unordered_set<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + typedef std::true_type is_unordered; + }; + + template<typename _Tp> + struct traits<std::vector<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + }; + + template<typename _Tp> + struct traits<std::basic_string<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + }; + + template<typename _Tp> + struct traits<__gnu_cxx::__versa_string<_Tp> > : public traits_base + { + typedef std::true_type is_container; + typedef std::true_type is_reversible; + typedef std::true_type is_allocator_aware; + typedef std::true_type is_pointer_aware; + }; +} // namespace __gnu_test + +#endif diff --git a/libstdc++-v3/testsuite/util/testsuite_containers.h b/libstdc++-v3/testsuite/util/testsuite_containers.h new file mode 100644 index 00000000000..62bf38f3d1c --- /dev/null +++ b/libstdc++-v3/testsuite/util/testsuite_containers.h @@ -0,0 +1,238 @@ +// -*- C++ -*- + +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#ifndef _GLIBCXX_TESTSUITE_CONTAINERS_H +#define _GLIBCXX_TESTSUITE_CONTAINERS_H + +#include <cassert> +#include <testsuite_container_traits.h> + +// Container requirement testing. +namespace __gnu_test +{ + // Compile-time typedef testing. + template<typename _Tp, bool _Bt = traits<_Tp>::is_container::value> + struct basic_types + { + // Base container requirements (table 80) + typedef _Tp test_type; + typedef typename test_type::value_type value_type; + typedef typename test_type::reference reference; + typedef typename test_type::const_reference const_reference; + typedef typename test_type::iterator iterator; + typedef typename test_type::const_iterator const_iterator; + typedef typename test_type::size_type size_type; + typedef typename test_type::difference_type difference_type; + }; + + // Conditional typedef testing, positive. + template<typename _Tp, bool _Bt = traits<_Tp>::is_reversible::value> + struct reversible_types + { + // Reversible container requirements (table 81) + typedef _Tp test_type; + typedef typename test_type::reverse_iterator reverse_iterator; + typedef typename test_type::const_reverse_iterator const_reverse_iterator; + }; + + template<typename _Tp, bool _Bt = traits<_Tp>::is_allocator_aware::value> + struct allocator_aware_types + { + // Allocator-aware requirements (table 82) + typedef _Tp test_type; + typedef typename test_type::allocator_type allocator_type; + }; + + template<typename _Tp, bool _Bt = traits<_Tp>::is_pointer_aware::value> + struct pointer_aware_types + { + // Allocator-aware requirements (table 82) + typedef _Tp test_type; + typedef typename test_type::pointer pointer; + typedef typename test_type::const_pointer const_pointer; + }; + + template<typename _Tp, bool _Bt = traits<_Tp>::is_associative::value> + struct associative_types + { + // Associative container requirements (table 85) + typedef _Tp test_type; + typedef typename test_type::key_type key_type; + typedef typename test_type::key_compare key_compare; + typedef typename test_type::value_compare value_compare; + }; + + template<typename _Tp, bool = traits<_Tp>::is_unordered::value> + struct unordered_types + { + // Unordered associative container requirements (table 87) + typedef _Tp test_type; + typedef typename test_type::key_type key_type; + typedef typename test_type::hasher hasher; + typedef typename test_type::key_equal key_equal; + typedef typename test_type::local_iterator local_iterator; + typedef typename test_type::const_local_iterator const_local_iterator; + }; + + template<typename _Tp, bool _Bt = traits<_Tp>::is_mapped::value> + struct mapped_types + { + typedef _Tp test_type; + typedef typename test_type::mapped_type mapped_type; + }; + + template<typename _Tp, bool = traits<_Tp>::is_adaptor::value> + struct adaptor_types + { + // Container adaptor requirements. + typedef _Tp test_type; + typedef typename test_type::value_type value_type; + typedef typename test_type::reference reference; + typedef typename test_type::const_reference const_reference; + typedef typename test_type::size_type size_type; + typedef typename test_type::container_type container_type; + }; + + // Conditional typedef testing, negative. + template<typename _Tp> + struct basic_types<_Tp, false> { }; + + template<typename _Tp> + struct reversible_types<_Tp, false> { }; + + template<typename _Tp> + struct allocator_aware_types<_Tp, false> { }; + + template<typename _Tp> + struct pointer_aware_types<_Tp, false> { }; + + template<typename _Tp> + struct associative_types<_Tp, false> { }; + + template<typename _Tp> + struct unordered_types<_Tp, false> { }; + + template<typename _Tp> + struct mapped_types<_Tp, false> { }; + + template<typename _Tp> + struct adaptor_types<_Tp, false> { }; + + // Primary template. + template<typename _Tp> + struct types + : basic_types<_Tp>, adaptor_types<_Tp>, reversible_types<_Tp>, + allocator_aware_types<_Tp>, pointer_aware_types<_Tp>, + associative_types<_Tp>, unordered_types<_Tp>, mapped_types<_Tp> + { }; + + + // Run-time test for constant_iterator requirements. + template<typename _Tp, bool = traits<_Tp>::is_allocator_aware::value> + struct populate + { + populate(_Tp& container) + { + typename _Tp::value_type v; + container.insert(container.begin(), v); + container.insert(container.begin(), v); + } + }; + + template<typename _Tp> + struct populate<_Tp, false> + { + populate(_Tp& container) { } + }; + + template<typename _Tp, bool = traits<_Tp>::is_reversible::value> + struct reverse_members + { + reverse_members(_Tp& container) + { + assert( container.crbegin() == container.rbegin() ); + assert( container.crend() == container.rend() ); + assert( container.crbegin() != container.crend() ); + } + }; + + template<typename _Tp> + struct reverse_members<_Tp, false> + { + reverse_members(_Tp& container) { } + }; + + // DR 691. + template<typename _Tp, bool = traits<_Tp>::is_unordered::value> + struct forward_members_unordered + { + forward_members_unordered(typename _Tp::value_type& v) + { + typedef _Tp test_type; + test_type container; + container.insert(v); + assert( container.cbegin(0) == container.begin(0) ); + assert( container.cend(0) == container.end(0) ); + const typename test_type::size_type bn = container.bucket(1); + assert( container.cbegin(bn) != container.cend(bn) ); + } + }; + + template<typename _Tp> + struct forward_members_unordered<_Tp, false> + { + forward_members_unordered(_Tp& container) { } + }; + + template<typename _Tp> + struct citerator + { + typedef _Tp test_type; + typedef traits<test_type> traits_type; + typedef typename test_type::value_type value_type; + + static test_type _S_container; + + // Unconditional. + struct forward_members + { + forward_members() + { + assert( _S_container.cbegin() == _S_container.begin() ); + assert( _S_container.cend() == _S_container.end() ); + assert( _S_container.cbegin() != _S_container.cend() ); + } + }; + + // Run test. + citerator() + { + populate<test_type> p(_S_container); + forward_members m1; + reverse_members<test_type> m2(_S_container); + } + }; + + template<typename _Tp> + _Tp citerator<_Tp>::_S_container; + + +} // namespace __gnu_test + +#endif |