diff options
Diffstat (limited to 'gcc-4.9/libstdc++-v3/testsuite')
37 files changed, 1176 insertions, 12 deletions
diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc index ff6a15940..0cc69f0a9 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 2040 } +// { dg-error "static assertion failed" "" { target *-*-* } 2057 } #include <utility> diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/forward/c_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/forward/c_neg.cc index fb900e01c..ce414de01 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/forward/c_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/forward/c_neg.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 89 } +// { dg-error "static assertion failed" "" { target *-*-* } 92 } #include <list> diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/forward/f_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/forward/f_neg.cc index c4914f0f7..4d5018544 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/forward/f_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/forward/f_neg.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 89 } +// { dg-error "static assertion failed" "" { target *-*-* } 92 } #include <utility> diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/function/63840.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/function/63840.cc new file mode 100644 index 000000000..cf80aa1dc --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/function/63840.cc @@ -0,0 +1,55 @@ +// Copyright (C) 2014 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/>. + +// { dg-options "-std=gnu++11" } + +#include <functional> +#include <stdexcept> +#include <testsuite_hooks.h> + +struct functor +{ + functor() = default; + + functor(const functor&) + { + throw std::runtime_error("test"); + } + + functor(functor&& f) = default; + + void operator()() const { } +}; + + +void +test01() +{ + std::function<void()> f = functor{}; + try { + auto g = f; + } catch (const std::runtime_error& e) { + return; + } + VERIFY(false); +} + +int +main() +{ + test01(); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_final/requirements/explicit_instantiation.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_final/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..c5d44e6bc --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_final/requirements/explicit_instantiation.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +// Copyright (C) 2014 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/>. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct is_final<test_type>; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_final/requirements/typedefs.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_final/requirements/typedefs.cc new file mode 100644 index 000000000..b07d90bec --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_final/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +// Copyright (C) 2014 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/>. + +// +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +void test01() +{ + // Check for required typedefs + typedef std::is_final<int> test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_final/value.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_final/value.cc new file mode 100644 index 000000000..281c1ab6d --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_final/value.cc @@ -0,0 +1,35 @@ +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +// Copyright (C) 2011-2014 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 <type_traits> +#include <testsuite_tr1.h> + +void test01() +{ + using std::is_final; + using namespace __gnu_test; + + // Positive test. + static_assert(test_category<is_final, FinalType>(true), ""); + + // Negative tests. + static_assert(test_category<is_final, ClassType>(false), ""); + static_assert(test_category<is_final, DerivedType>(false), ""); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index d71154605..eaad899b0 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -48,5 +48,5 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1747 } -// { dg-error "declaration of" "" { target *-*-* } 1711 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1764 } +// { dg-error "declaration of" "" { target *-*-* } 1728 } diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index c77205be0..40811a858 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -48,5 +48,5 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1650 } -// { dg-error "declaration of" "" { target *-*-* } 1614 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1667 } +// { dg-error "declaration of" "" { target *-*-* } 1631 } diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/64476.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/64476.cc new file mode 100644 index 000000000..6369b17af --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/64476.cc @@ -0,0 +1,65 @@ +// Copyright (C) 2015 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/>. + +// { dg-options "-std=gnu++11" } + +#include <memory> +#include <testsuite_hooks.h> + +struct X +{ + X() = default; + X(X const &) = default; + X& operator=(X const&) = delete; +}; + +static_assert(__is_trivial(X), "X is trivial"); + +int constructed = 0; +int assigned = 0; + +struct Y +{ + Y() = default; + Y(Y const &) = default; + Y& operator=(Y const&) = default; + + Y(const X&) { ++constructed; } + Y& operator=(const X&)& { ++assigned; return *this; } + Y& operator=(const X&)&& = delete; + Y& operator=(X&&) = delete; +}; + +static_assert(__is_trivial(Y), "Y is trivial"); + +void +test01() +{ + X a[100]; + Y b[100]; + + std::uninitialized_copy(a, a+10, b); + + VERIFY(constructed == 0); + VERIFY(assigned == 10); +} + +int +main() +{ + test01(); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/61947.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/61947.cc new file mode 100644 index 000000000..7e77de657 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/61947.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2014 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 <tuple> + +struct ConvertibleToAny { + template <class T> operator T() const { return T(); } +}; + +int main() { + std::tuple<ConvertibleToAny&&> t(ConvertibleToAny{}); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc index 5ce344c37..898406ffa 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc @@ -44,4 +44,4 @@ void test01() tuple<Type> t(allocator_arg, a, 1); } -// { dg-error "no matching function" "" { target *-*-* } 118 } +// { dg-error "no matching function" "" { target *-*-* } 119 } diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc new file mode 100644 index 000000000..efe73aee8 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2014 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/>. + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <queue> + +template<typename A> + using uses_allocator = std::uses_allocator<std::priority_queue<int>, A>; + +static_assert( uses_allocator<std::allocator<int>>::value, "valid allocator" ); + +struct X { }; +static_assert( !uses_allocator<X>::value, "invalid allocator" ); diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc new file mode 100644 index 000000000..42106caf8 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2014 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/>. + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <queue> + +template<typename A> + using uses_allocator = std::uses_allocator<std::queue<int>, A>; + +static_assert( uses_allocator<std::allocator<int>>::value, "valid allocator" ); + +struct X { }; +static_assert( !uses_allocator<X>::value, "invalid allocator" ); diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc new file mode 100644 index 000000000..3663d633b --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2014 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/>. + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <stack> + +template<typename A> + using uses_allocator = std::uses_allocator<std::stack<int>, A>; + +static_assert( uses_allocator<std::allocator<int>>::value, "valid allocator" ); + +struct X { }; +static_assert( !uses_allocator<X>::value, "invalid allocator" ); diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_set/63456.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_set/63456.cc new file mode 100644 index 000000000..eba363c00 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_set/63456.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2014 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/>. + +// { dg-options "-std=gnu++11" } + +#include <unordered_set> + +void test01() +{ + std::unordered_set<int> s1, s2; + s2.insert(2); + + s1 = s2; +} + +int main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/63500.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/63500.cc new file mode 100644 index 000000000..99fc9f400 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/63500.cc @@ -0,0 +1,39 @@ +// -*- C++ -*- + +// Copyright (C) 2014 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/>. + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <memory> +#include <iterator> +#include <debug/vector> + +class Foo +{}; + +void +test01() +{ + __gnu_debug::vector<std::unique_ptr<Foo>> v; + __gnu_debug::vector<std::unique_ptr<Foo>> w; + + v.insert(end(v), + make_move_iterator(begin(w)), + make_move_iterator(end(w))); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc b/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc new file mode 100644 index 000000000..799a18c5d --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/is_permutation/64646.cc @@ -0,0 +1,35 @@ +// Copyright (C) 2015 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/>. + +// { dg-options "-std=gnu++14" } + +#include <algorithm> +#include <forward_list> +#include <testsuite_hooks.h> + +void +test01() +{ + std::forward_list<int> l1{0}, l2; + VERIFY( !std::is_permutation(l1.begin(), l1.end(), l2.begin(), l2.end()) ); +} + +int +main() +{ + test01(); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/random_shuffle/59603.cc b/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/random_shuffle/59603.cc new file mode 100644 index 000000000..7b179ac19 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/random_shuffle/59603.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2014 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/>. + +// { dg-options "-std=gnu++11" } +// { dg-require-debug-mode "" } + +// libstdc++/59603 + +#include <algorithm> +#include <vector> + +struct C { + std::vector<int> v; + C (int a) : v{a} {}; +}; + +int main () { + std::vector<C> cs { {1}, {2}, {3}, {4} }; + std::random_shuffle(cs.begin(), cs.end()); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/unique/11480.cc b/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/unique/11480.cc index b007feb93..82745856d 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/unique/11480.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/25_algorithms/unique/11480.cc @@ -33,7 +33,7 @@ void test01() { bool test __attribute__((unused)) = true; - std::unique(a, a+10, compare); + int* dummy __attribute__((unused)) = std::unique(a, a+10, compare); VERIFY( compare_count == 9 ); } diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/63199.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/63199.cc new file mode 100644 index 000000000..cbb23f7de --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/63199.cc @@ -0,0 +1,69 @@ +// { dg-options "-std=gnu++11" } + +// +// Copyright (C) 2014 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 <regex> +#include <testsuite_hooks.h> +#include <testsuite_regex.h> + +using namespace __gnu_test; +using namespace std; + +// libstdc++/63199 +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::setlocale(LC_ALL, ""); + + std::wstring current_token(L"II."); + + std::vector<std::wregex> regex_vector; + + for (int i = 0; i < 4; ++i) + { + std::regex_constants::syntax_option_type flag; + flag = std::regex_constants::ECMAScript | std::regex_constants::icase; + + std::wregex reg; + reg.imbue(std::locale("")); + reg.assign(L"^(M*(?:CM|DC{1,3}|D|CD|C{1,3}){0,1}(?:XC|LX{1,3}|L|XL|X{1,3}){0,1}(?:IX|VI{0,3}|IV|I{1,3}){0,1}\\.)$", flag); + + regex_vector.emplace_back(reg); + } + + for (auto cit = regex_vector.cbegin(); cit != regex_vector.cend(); ++cit) + { + std::wstring::const_iterator it1 = current_token.begin(); + std::wstring::const_iterator it2 = current_token.end(); + std::wsmatch current_token_match; + + regex_match_debug(it1, it2, current_token_match, *cit); + VERIFY(current_token_match[0] == current_token); + VERIFY(current_token_match[1] == current_token); + } +} + +int +main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/string.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/string.cc index 0a32ab5e6..7d4db8f10 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/string.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/assign/char/string.cc @@ -1,4 +1,3 @@ -// { dg-do compile } // { dg-options "-std=gnu++0x" } // 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com> @@ -29,6 +28,7 @@ // Tests C++ string assignment of the basic_regex class. void test01() { + bool test __attribute__((unused)) = true; typedef std::basic_regex<char> test_type; std::string s("a*b"); @@ -36,9 +36,27 @@ void test01() re.assign(s); } +// libstdc++/64584 +void test02() +{ + bool test __attribute__((unused)) = true; + std::regex re("", std::regex_constants::extended); + auto flags = re.flags(); + try + { + re.assign("(", std::regex_constants::icase); + VERIFY(false); + } + catch (const std::regex_error& e) + { + VERIFY(flags == re.flags()); + } +} + int main() { test01(); + test02(); return 0; } diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/imbue/string.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/imbue/string.cc new file mode 100644 index 000000000..d4d4f4705 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/imbue/string.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++11" } + +// Copyright (C) 2015 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/>. + +// [28.8.5] class template basic_regex locale + +#include <string> +#include <regex> +#include <testsuite_hooks.h> + +// libstdc++/64585 +void test01() +{ + bool test __attribute__((unused)) = true; + + static const char s[] = "a"; + std::regex re("a"); + VERIFY(std::regex_search(s, re)); + + auto loc = re.imbue(re.getloc()); + VERIFY(!std::regex_search(s, re)); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/64140.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/64140.cc new file mode 100644 index 000000000..32b7e241c --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/64140.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++11" } + +// +// Copyright (C) 2014 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/>. + +// libstdc++/64140 + +#include <regex> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + const std::regex e("z*"); + const std::string s("ab"); + + auto it = std::sregex_iterator(s.begin(), s.end(), e); + auto end = std::sregex_iterator(); + VERIFY(it != end); + VERIFY(!it->prefix().matched); + ++it; + VERIFY(it != end); + VERIFY(it->prefix().matched); + ++it; + VERIFY(it != end); + VERIFY(it->prefix().matched); + ++it; + VERIFY(it == end); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc index 5fa4ea774..91aa06137 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc @@ -24,6 +24,7 @@ // Tests iter->position() behavior #include <regex> +#include <tuple> #include <testsuite_hooks.h> void @@ -41,9 +42,53 @@ test01() } } +// PR libstdc++/64239 +void +test02() +{ + bool test __attribute__((unused)) = true; + + std::regex re("\\w+"); + std::string s("-a-b-c-"); + + std::tuple<int, int, const char*> expected[] = + { + std::make_tuple(1, 1, "a"), + std::make_tuple(3, 1, "b"), + std::make_tuple(5, 1, "c"), + }; + + int i = 0; + for (auto it1 = std::sregex_iterator(s.begin(), s.end(), re), + end = std::sregex_iterator(); it1 != end; ++it1, i++) + { + auto it2 = it1; + VERIFY(it1->position() == std::get<0>(expected[i])); + VERIFY(it1->length() == std::get<1>(expected[i])); + VERIFY(it1->str() == std::get<2>(expected[i])); + VERIFY(it2->position() == std::get<0>(expected[i])); + VERIFY(it2->length() == std::get<1>(expected[i])); + VERIFY(it2->str() == std::get<2>(expected[i])); + } +} + +void +test03() +{ + bool test __attribute__((unused)) = true; + + std::smatch m; + std::string s = "abcde"; + std::regex_search(s, m, std::regex("bcd")); + VERIFY(m.position() == 1); + VERIFY(m.position() == m.prefix().length()); +} + int main() { test01(); + test02(); + test03(); return 0; } diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc new file mode 100644 index 000000000..f09bbe1c9 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc @@ -0,0 +1,49 @@ +// { dg-do run } +// { dg-options "-std=gnu++11" } + +// +// Copyright (C) 2014 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/>. + +// 28.12.2 Class template regex_token_iterator + +#include <regex> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + const std::string s(" 111 222 "); + const std::regex re("\\w+"); + + std::sregex_token_iterator it1(s.begin(), s.end(), re), it2(it1), end; + + for (; it1 != end; ++it1, ++it2) { + VERIFY(it1 == it2); + VERIFY(*it1 == *it2); + } + VERIFY(it2 == end); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/match_results/swap.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/match_results/swap.cc new file mode 100644 index 000000000..18248c1c5 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/match_results/swap.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++11" } + +// +// Copyright (C) 2015 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 <regex> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::cmatch m; + std::regex_match("a", m, std::regex("a")); + std::cmatch mm1 = m, mm2; + mm1.swap(mm2); + VERIFY(m == mm2); + std::swap(mm1, mm2); + VERIFY(m == mm1); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc index 48ab04375..f2a99ab4a 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/traits/char/lookup_classname.cc @@ -26,6 +26,7 @@ // 28.7(9) Class template regex_traits [re.traits] #include <regex> +#include <forward_list> #include <testsuite_hooks.h> void @@ -47,8 +48,29 @@ test01() VERIFY( c2 == c3 ); } +// Test forward iterator +void +test02() +{ + const char strlit[] = "upper"; + std::forward_list<char> s(strlit, strlit + strlen(strlit)); + std::regex_traits<char> traits; + VERIFY(traits.isctype('C', traits.lookup_classname(s.begin(), s.end(), false))); +} + +// icase +void +test03() +{ + std::string s("lower"); + std::regex_traits<char> traits; + VERIFY(traits.isctype('C', traits.lookup_classname(s.begin(), s.end(), true))); +} + int main() { test01(); + test02(); + test03(); return 0; } diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc index 825f2ba2b..698c18df7 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc @@ -26,6 +26,7 @@ // 28.7 (8) Class template regex_traits [re.traits] #include <regex> +#include <forward_list> #include <testsuite_hooks.h> void @@ -40,8 +41,19 @@ test01() VERIFY(t.lookup_collatename(name, name+sizeof(name)-1) == "~"); } +// Test forward iterator. +void +test02() +{ + const char strlit[] = "tilde"; + std::forward_list<char> s(strlit, strlit + strlen(strlit)); + std::regex_traits<char> traits; + VERIFY(traits.lookup_collatename(s.begin(), s.end()) == "~"); +} + int main() { test01(); + test02(); return 0; } diff --git a/gcc-4.9/libstdc++-v3/testsuite/29_atomics/atomic/62259.cc b/gcc-4.9/libstdc++-v3/testsuite/29_atomics/atomic/62259.cc new file mode 100644 index 000000000..42b45ec6a --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/29_atomics/atomic/62259.cc @@ -0,0 +1,59 @@ +// Copyright (C) 2015 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/>. + +// { dg-require-atomic-builtins "" } +// { dg-require-cstdint "" } +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <atomic> +#include <cstdint> + +using std::int32_t; +using std::int64_t; + +// libstdc++/62259 + +struct twoints { + int32_t a; + int32_t b; +}; + +static_assert( alignof(std::atomic<twoints>) == alignof(int64_t), + "std::atomic not suitably aligned" ); + +// libstdc++/65147 + +struct power_of_two_obj { + char c [8]; +}; + +std::atomic<power_of_two_obj> obj1; + +static_assert( alignof(obj1) == alignof(int64_t), + "std::atomic not suitably aligned" ); + +struct container_struct { + char c[1]; + std::atomic<power_of_two_obj> ao; +}; + +container_struct obj2; + +static_assert( alignof(obj2.ao) == alignof(int64_t), + "std::atomic not suitably aligned" ); + diff --git a/gcc-4.9/libstdc++-v3/testsuite/29_atomics/atomic/65147.cc b/gcc-4.9/libstdc++-v3/testsuite/29_atomics/atomic/65147.cc new file mode 100644 index 000000000..15c794e2b --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/29_atomics/atomic/65147.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2015 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/>. + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <atomic> + +struct S16 { + char c[16]; +}; + +static_assert( alignof(std::atomic<S16>) >= 16, + "atomic<S16> must be aligned to at least its size" ); + diff --git a/gcc-4.9/libstdc++-v3/testsuite/29_atomics/atomic_integral/65147.cc b/gcc-4.9/libstdc++-v3/testsuite/29_atomics/atomic_integral/65147.cc new file mode 100644 index 000000000..1cc33e3b8 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/29_atomics/atomic_integral/65147.cc @@ -0,0 +1,33 @@ +// Copyright (C) 2015 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/>. + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <atomic> + +static_assert( alignof(std::atomic<char>) >= sizeof(char), + "atomic<char> must be aligned to at least its size" ); +static_assert( alignof(std::atomic<short>) >= sizeof(short), + "atomic<short> must be aligned to at least its size" ); +static_assert( alignof(std::atomic<int>) >= sizeof(int), + "atomic<int> must be aligned to at least its size" ); +static_assert( alignof(std::atomic<long>) >= sizeof(long), + "atomic<long> must be aligned to at least its size" ); +static_assert( alignof(std::atomic<long long>) >= sizeof(long long), + "atomic<long long> must be aligned to at least its size" ); + diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/try_lock/4.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/try_lock/4.cc index de9b69eef..86fe14e29 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/30_threads/try_lock/4.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/try_lock/4.cc @@ -133,8 +133,15 @@ void test03() while (unreliable_lock::throw_on < 3) { unreliable_lock::count = 0; - int failed = std::try_lock(l1, l2, l3); - VERIFY( failed == unreliable_lock::throw_on ); + try + { + std::try_lock(l1, l2, l3); + VERIFY( false ); + } + catch (int e) + { + VERIFY( e == unreliable_lock::throw_on ); + } ++unreliable_lock::throw_on; } } diff --git a/gcc-4.9/libstdc++-v3/testsuite/experimental/feat-cxx14.cc b/gcc-4.9/libstdc++-v3/testsuite/experimental/feat-cxx14.cc new file mode 100644 index 000000000..2cc31ca03 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/experimental/feat-cxx14.cc @@ -0,0 +1,121 @@ +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +#include <utility> +#include <tuple> +#include <memory> +#include <functional> +#include <type_traits> +#include <chrono> +#include <string> +#include <complex> +#include <iomanip> +#include <shared_mutex> + +#ifndef __cpp_lib_integer_sequence +# error "__cpp_lib_integer_sequence" +#elif __cpp_lib_integer_sequence != 201304 +# error "__cpp_lib_integer_sequence != 201304" +#endif + +#ifndef __cpp_lib_exchange_function +# error "__cpp_lib_exchange_function" +#elif __cpp_lib_exchange_function != 201304 +# error "__cpp_lib_exchange_function != 201304" +#endif + +#ifndef __cpp_lib_tuples_by_type +# error "__cpp_lib_tuples_by_type" +#elif __cpp_lib_tuples_by_type != 201304 +# error "__cpp_lib_tuples_by_type != 201304" +#endif + +#ifndef __cpp_lib_make_unique +# error "__cpp_lib_make_unique" +#elif __cpp_lib_make_unique != 201304 +# error "__cpp_lib_make_unique != 201304" +#endif + +#ifndef __cpp_lib_transparent_operators +# error "__cpp_lib_transparent_operators" +#elif __cpp_lib_transparent_operators != 201210 +# error "__cpp_lib_transparent_operators != 201210" +#endif + +#ifndef __cpp_lib_result_of_sfinae +# error "__cpp_lib_result_of_sfinae" +#elif __cpp_lib_result_of_sfinae != 201210 +# error "__cpp_lib_result_of_sfinae != 201210" +#endif + +#ifndef __cpp_lib_integral_constant_callable +# error "__cpp_lib_integral_constant_callable" +#elif __cpp_lib_integral_constant_callable != 201304 +# error "__cpp_lib_integral_constant_callable != 201304" +#endif + +#ifndef __cpp_lib_transformation_trait_aliases +# error "__cpp_lib_transformation_trait_aliases" +#elif __cpp_lib_transformation_trait_aliases != 201304 +# error "__cpp_lib_transformation_trait_aliases != 201304" +#endif + +#ifndef __cpp_lib_chrono_udls +# error "__cpp_lib_chrono_udls" +#elif __cpp_lib_chrono_udls != 201304 +# error "__cpp_lib_chrono_udls != 201304" +#endif + +#ifndef __cpp_lib_string_udls +# error "__cpp_lib_string_udls" +#elif __cpp_lib_string_udls != 201304 +# error "__cpp_lib_string_udls != 201304" +#endif + +#ifndef __cpp_lib_complex_udls +# error "__cpp_lib_complex_udls" +#elif __cpp_lib_complex_udls != 201309 +# error "__cpp_lib_complex_udls != 201309" +#endif + +//#ifndef __cpp_lib_generic_associative_lookup +//# error "__cpp_lib_generic_associative_lookup" +//#elif __cpp_lib_generic_associative_lookup != 201304 +//# error "__cpp_lib_generic_associative_lookup != 201304" +//#endif + +//#ifndef __cpp_lib_null_iterators +//# error "__cpp_lib_null_iterators" +//#elif __cpp_lib_null_iterators != 201304 +//# error "__cpp_lib_null_iterators != 201304" +//#endif + +#ifndef __cpp_lib_robust_nonmodifying_seq_ops +# error "__cpp_lib_robust_nonmodifying_seq_ops" +#elif __cpp_lib_robust_nonmodifying_seq_ops != 201304 +# error "__cpp_lib_robust_nonmodifying_seq_ops != 201304" +#endif + +#ifndef __cpp_lib_quoted_string_io +# error "__cpp_lib_quoted_string_io" +#elif __cpp_lib_quoted_string_io != 201304 +# error "__cpp_lib_quoted_string_io != 201304" +#endif + +#if !__has_include(<shared_mutex>) +# error "<shared_mutex>" +#endif + +#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) +# ifndef __cpp_lib_shared_timed_mutex +# error "__cpp_lib_shared_timed_mutex" +# elif __cpp_lib_shared_timed_mutex != 201402 +# error "__cpp_lib_shared_timed_mutex != 201402" +# endif +#endif + +#ifndef __cpp_lib_is_final +# error "__cpp_lib_is_final" +#elif __cpp_lib_is_final != 201402 +# error "__cpp_lib_is_final != 201402" +#endif diff --git a/gcc-4.9/libstdc++-v3/testsuite/experimental/feat-lib-fund.cc b/gcc-4.9/libstdc++-v3/testsuite/experimental/feat-lib-fund.cc new file mode 100644 index 000000000..ac8560dfb --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/experimental/feat-lib-fund.cc @@ -0,0 +1,25 @@ +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +#include <experimental/optional> +#include <experimental/string_view> + +#if !__has_include(<experimental/optional>) +# error "<experimental/optional>" +#endif + +//#if !__has_include(<experimental/net>) +//# error "<experimental/net>" +//#endif + +//#if !__has_include(<experimental/any>) +//# error "<experimental/any>" +//#endif + +//#if !__has_include(<experimental/memory_resource>) +//# error "<experimental/memory_resource>" +//#endif + +#if !__has_include(<experimental/string_view>) +# error "<experimental/string_view>" +#endif diff --git a/gcc-4.9/libstdc++-v3/testsuite/tr1/3_function_objects/function/63840.cc b/gcc-4.9/libstdc++-v3/testsuite/tr1/3_function_objects/function/63840.cc new file mode 100644 index 000000000..760d490f2 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/tr1/3_function_objects/function/63840.cc @@ -0,0 +1,55 @@ +// Copyright (C) 2014 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 <tr1/functional> +#include <stdexcept> +#include <testsuite_hooks.h> + +struct functor +{ + functor() : copies(0) { } + + functor(const functor& f) + : copies(f.copies + 1) + { + if (copies > 1) + throw std::runtime_error("functor"); + } + + void operator()() const { } + + int copies; +}; + + +void +test01() +{ + std::tr1::function<void()> f = functor(); + try { + std::tr1::function<void()> g = f; + } catch (const std::runtime_error& e) { + return; + } + VERIFY(false); +} + +int +main() +{ + test01(); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/util/testsuite_tr1.h b/gcc-4.9/libstdc++-v3/testsuite/util/testsuite_tr1.h index aa80a2146..6e962961b 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/util/testsuite_tr1.h +++ b/gcc-4.9/libstdc++-v3/testsuite/util/testsuite_tr1.h @@ -100,6 +100,10 @@ namespace __gnu_test class DerivedType : public ClassType { }; +#if __cplusplus >= 201103L + class FinalType final : public DerivedType { }; +#endif + enum EnumType { e0 }; struct ConvType |