diff options
Diffstat (limited to 'gcc-4.9/libstdc++-v3/testsuite/20_util')
12 files changed, 255 insertions, 8 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 } |