diff options
Diffstat (limited to 'gcc-4.9/libstdc++-v3/testsuite')
46 files changed, 653 insertions, 33 deletions
diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/requirements/explicit_instantiation.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/requirements/explicit_instantiation.cc index 9d80c5a89..0cee459a4 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/requirements/explicit_instantiation.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/requirements/explicit_instantiation.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/requirements/typedefs.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/requirements/typedefs.cc index 7f2b1b899..e47147191 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/requirements/typedefs.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/requirements/typedefs.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/value.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/value.cc index 5ad741d8b..29b8719da 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/value.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/alignment_of/value.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 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 a744d8326..ff6a15940 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 *-*-* } 2003 } +// { dg-error "static assertion failed" "" { target *-*-* } 2040 } #include <utility> diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/function/60594.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/function/60594.cc new file mode 100644 index 000000000..be80b3f44 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/function/60594.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++11" } +// { 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/>. + +// libstdc++/60594 + +#include <functional> +#include <type_traits> +struct bar; +using F = std::function<bar()>; +// check for copy constructible and assignable while 'bar' is incomplete +constexpr int c = std::is_copy_constructible<F>::value; +constexpr int a = std::is_copy_assignable<F>::value; +struct bar { }; +bar func(); +void test() +{ + F g{ &func }; + g = func; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/explicit_instantiation.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/explicit_instantiation.cc index 5edbbd0a4..af5871fe8 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/explicit_instantiation.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/explicit_instantiation.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/typedefs.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/typedefs.cc index b00698ba9..1e4bd3274 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/typedefs.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/requirements/typedefs.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/value.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/value.cc index 15c0eb2f8..7ab6a5d5b 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/value.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/has_virtual_destructor/value.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/requirements/explicit_instantiation.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/requirements/explicit_instantiation.cc index 43639b8c5..1ae681fe4 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/requirements/explicit_instantiation.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/requirements/explicit_instantiation.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/requirements/typedefs.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/requirements/typedefs.cc index bb847d325..b9fcb85bf 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/requirements/typedefs.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/requirements/typedefs.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/value.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/value.cc index c056a8e7c..a8e336d37 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/value.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_array/value.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/requirements/explicit_instantiation.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/requirements/explicit_instantiation.cc index 6c7eb7d24..f467bc263 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/requirements/explicit_instantiation.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/requirements/explicit_instantiation.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/requirements/typedefs.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/requirements/typedefs.cc index 93f3ecb31..6c1866665 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/requirements/typedefs.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/requirements/typedefs.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/value.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/value.cc index ccd187a7c..c418f7640 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/value.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_enum/value.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/requirements/explicit_instantiation.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/requirements/explicit_instantiation.cc index 3ae51e5fc..1786bf7bc 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/requirements/explicit_instantiation.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/requirements/explicit_instantiation.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/requirements/typedefs.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/requirements/typedefs.cc index f12acab81..3b574c4f2 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/requirements/typedefs.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/requirements/typedefs.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/value.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/value.cc index 2c6d8c002..b8a3835e5 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/value.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/is_union/value.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc index e3b84d649..5b094d9a4 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc @@ -29,6 +29,7 @@ void test01() using std::make_signed; using std::is_same; using std::is_signed; + using std::is_volatile; // Positive tests. typedef make_signed<const int>::type test2_type; @@ -53,7 +54,9 @@ void test01() #ifdef _GLIBCXX_USE_WCHAR_T typedef make_signed<volatile wchar_t>::type test23_type; - static_assert( is_same<test23_type, volatile signed wchar_t>::value, + static_assert( is_signed<test23_type>::value + && is_volatile<test23_type>::value + && sizeof(test23_type) == sizeof(volatile wchar_t), "make_signed<volatile wchar_t>" ); #endif diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc index 654b3759c..3f47dba5b 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc @@ -30,6 +30,8 @@ void test01() { using std::make_signed; using std::is_same; + using std::is_signed; + using std::is_volatile; // Positive tests. typedef make_signed<const int>::type test2_type; @@ -50,7 +52,9 @@ void test01() #ifdef _GLIBCXX_USE_WCHAR_T typedef make_signed<volatile wchar_t>::type test23_type; - static_assert(is_same<test23_type, volatile signed wchar_t>::value, ""); + static_assert(is_signed<test23_type>::value + && is_volatile<test23_type>::value + && sizeof(test23_type) == sizeof(volatile wchar_t), ""); #endif typedef make_signed<test_enum>::type test24_type; diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-3.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-3.cc index 16c7c90c5..f76900403 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-3.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-3.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++1y" } // { dg-do compile } -// Copyright (C) 2013-2014 Free Software Foundation, Inc. +// Copyright (C) 2013 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 diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-4.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-4.cc new file mode 100644 index 000000000..4950e5470 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-4.cc @@ -0,0 +1,33 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// { dg-require-cstdint "" } + +// 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 <type_traits> + +// libstdc++/60326 + +using namespace std; +#ifdef _GLIBCXX_USE_WCHAR_T +using wchar_signed = make_signed<wchar_t>::type; +using wchar_unsigned = make_unsigned<wchar_t>::type; +static_assert( !is_same<wchar_signed, wchar_unsigned>::value, "wchar_t" ); +#endif +static_assert( is_signed<make_signed<char16_t>::type>::value, "char16_t"); +static_assert( is_signed<make_signed<char32_t>::type>::value, "char32_t"); 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 9f155ea92..d71154605 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 *-*-* } 1714 } -// { dg-error "declaration of" "" { target *-*-* } 1678 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1747 } +// { dg-error "declaration of" "" { target *-*-* } 1711 } diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc index f07cf4a62..de655048f 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc @@ -29,6 +29,7 @@ void test01() using std::make_unsigned; using std::is_same; using std::is_unsigned; + using std::is_volatile; // Positive tests. typedef make_unsigned<const unsigned int>::type test2_type; @@ -49,7 +50,9 @@ void test01() #ifdef _GLIBCXX_USE_WCHAR_T typedef make_unsigned<volatile wchar_t>::type test23_type; - static_assert(is_same<test23_type, volatile wchar_t>::value, ""); + static_assert(is_unsigned<test23_type>::value + && is_volatile<test23_type>::value + && sizeof(test23_type) == sizeof(volatile wchar_t), ""); #endif // Chapter 48, chapter 20. Smallest rank such that new unsigned type diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc index 8997fb7d8..7801dca94 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc @@ -30,6 +30,8 @@ void test01() { using std::make_unsigned; using std::is_same; + using std::is_unsigned; + using std::is_volatile; // Positive tests. typedef make_unsigned<const unsigned int>::type test2_type; @@ -50,7 +52,9 @@ void test01() #ifdef _GLIBCXX_USE_WCHAR_T typedef make_unsigned<volatile wchar_t>::type test23_type; - static_assert(is_same<test23_type, volatile wchar_t>::value, ""); + static_assert(is_unsigned<test23_type>::value + && is_volatile<test23_type>::value + && sizeof(test23_type) == sizeof(volatile wchar_t), ""); #endif typedef make_unsigned<test_enum>::type test24_type; 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 57a5c6167..c77205be0 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 *-*-* } 1632 } -// { dg-error "declaration of" "" { target *-*-* } 1596 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1650 } +// { dg-error "declaration of" "" { target *-*-* } 1614 } diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/shared_ptr/cons/61036.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/shared_ptr/cons/61036.cc new file mode 100644 index 000000000..9cade6648 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/shared_ptr/cons/61036.cc @@ -0,0 +1,28 @@ +// { 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/>. + +// 20.8.2.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> + +void test01() +{ + std::shared_ptr<void> p(new int); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/60497.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/60497.cc new file mode 100644 index 000000000..76d422316 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/60497.cc @@ -0,0 +1,37 @@ +// { 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/>. + +// libstdc++/60497 + +#include <tuple> + +struct A; +template<typename T> struct B { T t; }; + +using element_type = B<A>*; +using tuple_type = std::tuple<element_type>; + +tuple_type t; +const tuple_type ct; + +auto a = std::get<0>(t); +auto b = std::get<0>(ct); +auto c = std::get<element_type>(t); +auto d = std::get<element_type>(ct); diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/element_access/get_by_type.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/element_access/get_by_type.cc index 226e9e4a8..042f2149a 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/element_access/get_by_type.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/element_access/get_by_type.cc @@ -41,4 +41,8 @@ main() get<1>(b)=5; VERIFY(get<int>(b)==1 && get<int&>(b)==5 && get<const int&>(b)==2); VERIFY(j==5); + // test rvalue overload: + VERIFY(get<int>(std::move(b))==1); + VERIFY(get<int&>(std::move(b))==5); + VERIFY(get<const int&>(std::move(b))==2); } diff --git a/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc b/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc new file mode 100644 index 000000000..e46af5c30 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc @@ -0,0 +1,36 @@ +// { 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/>. + +#include <tuple> + +using namespace std; + +struct foo +{ }; + +int +main() +{ + // As foo isn't constructible from anything else, this + // lets us check if the alias is returning foo when it should + foo q1; + tuple_element_t<0,tuple<foo,void,int> > q2(q1); + tuple_element_t<2,tuple<void,int,foo> > q3(q1); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc index 4de8f2d0f..b91c8f271 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1764 } +// { dg-error "no matching" "" { target *-*-* } 1810 } #include <deque> diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc index 41f290561..5bc384780 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1697 } +// { dg-error "no matching" "" { target *-*-* } 1743 } #include <deque> diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc index f77b12678..27d34e015 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1697 } +// { dg-error "no matching" "" { target *-*-* } 1743 } #include <deque> #include <utility> diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc index e7d5b1ee6..72fca0968 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1848 } +// { dg-error "no matching" "" { target *-*-* } 1894 } #include <deque> diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/set/cons/61023.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/set/cons/61023.cc new file mode 100644 index 000000000..087b9cc18 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/set/cons/61023.cc @@ -0,0 +1,56 @@ +// { 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 <set> +#include <stdexcept> + +struct Comparator +{ + Comparator() : valid(false) { } + explicit Comparator(bool) : valid(true) { } + + bool operator()(int i, int j) const + { + if (!valid) + throw std::logic_error("Comparator is invalid"); + return i < j; + } + +private: + bool valid; +}; + +int main() +{ + using test_type = std::set<int, Comparator>; + + Comparator cmp{true}; + + test_type good{cmp}; + + test_type s1; + s1 = good; // copy-assign + s1.insert(1); + s1.insert(2); + + test_type s2; + s2 = std::move(good); // move-assign + s2.insert(1); + s2.insert(2); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_set/61143.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_set/61143.cc new file mode 100644 index 000000000..b9464254f --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_set/61143.cc @@ -0,0 +1,38 @@ +// { 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++/61143 + +#include <unordered_set> + +void test01() +{ + std::unordered_set<int> us1, us2; + us1.insert(1); + + us2 = std::move(us1); + + us1.insert(1); +} + +int main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/swap.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/swap.cc new file mode 100644 index 000000000..d03fd1dc3 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/swap.cc @@ -0,0 +1,65 @@ +// 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> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + std::unordered_set<int> us1 { 0, 1 }; + { + std::unordered_set<int> us2(std::move(us1)); + + us1.swap(us2); + + VERIFY( us1.find(0) != us1.end() ); + + us1.insert(2); + + VERIFY( us1.size() == 3 ); + + us2.swap(us1); + + VERIFY( us2.size() == 3 ); + VERIFY( us2.find(2) != us2.end() ); + + us1 = { 3, 4, 5 }; + + VERIFY( us1.size() == 3 ); + VERIFY( us1.bucket_count() >= 3 ); + + std::unordered_set<int> us3(std::move(us1)); + us3 = std::move(us2); + + us1.swap(us2); + + VERIFY( us1.empty() ); + VERIFY( us2.empty() ); + } + + us1 = { 0, 1 }; + VERIFY( us1.size() == 2 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc index 655c7e8ad..369881ddb 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1326 } +// { dg-error "no matching" "" { target *-*-* } 1486 } #include <vector> diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc index d938aa21b..fb7a6d4c0 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1252 } +// { dg-error "no matching" "" { target *-*-* } 1412 } #include <vector> diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc index f88828562..1ed760f52 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1252 } +// { dg-error "no matching" "" { target *-*-* } 1412 } #include <vector> #include <utility> diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc index 316249b01..2fa2002d1 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1367 } +// { dg-error "no matching" "" { target *-*-* } 1527 } #include <vector> diff --git a/gcc-4.9/libstdc++-v3/testsuite/27_io/manipulators/standard/char/dr2344.cc b/gcc-4.9/libstdc++-v3/testsuite/27_io/manipulators/standard/char/dr2344.cc new file mode 100644 index 000000000..e220d35b2 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/27_io/manipulators/standard/char/dr2344.cc @@ -0,0 +1,50 @@ +// { dg-do run } +// { dg-options "-std=gnu++14" } + +// 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/>. + +// 27.7.6 - Quoted manipulators [quoted.manip] + +#include <sstream> +#include <iomanip> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test [[gnu::unused]] = true; + + std::ostringstream ssx; + ssx << "[" << std::left << std::setfill('x') << std::setw(20) << R"("AB \"CD\" EF")" << "]"; + VERIFY( ssx.str() == R"(["AB \"CD\" EF"xxxxxx])" ); + + std::ostringstream ssy; + ssy << "[" << std::left << std::setfill('y') << std::setw(20) << std::quoted(R"(GH "IJ" KL)") << "]"; + VERIFY( ssy.str() == R"(["GH \"IJ\" KL"yyyyyy])" ); + + std::ostringstream ssz; + ssz << "[" << std::right << std::setfill('z') << std::setw(20) << std::quoted(R"(PQ "RS" TU)") << "]"; + VERIFY( ssz.str() == R"([zzzzzz"PQ \"RS\" TU"])" ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/dr2344.cc b/gcc-4.9/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/dr2344.cc new file mode 100644 index 000000000..5bdabacc2 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/dr2344.cc @@ -0,0 +1,50 @@ +// { dg-do run } +// { dg-options "-std=gnu++14" } + +// 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/>. + +// 27.7.6 - Quoted manipulators [quoted.manip] + +#include <sstream> +#include <iomanip> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test [[gnu::unused]] = true; + + std::wostringstream ssx; + ssx << L"[" << std::left << std::setfill(L'x') << std::setw(20) << LR"("AB \"CD\" EF")" << L"]"; + VERIFY( ssx.str() == LR"(["AB \"CD\" EF"xxxxxx])" ); + + std::wostringstream ssy; + ssy << L"[" << std::left << std::setfill(L'y') << std::setw(20) << std::quoted(LR"(GH "IJ" KL)") << L"]"; + VERIFY( ssy.str() == LR"(["GH \"IJ\" KL"yyyyyy])" ); + + std::wostringstream ssz; + ssz << L"[" << std::right << std::setfill(L'z') << std::setw(20) << std::quoted(LR"(PQ "RS" TU)") << L"]"; + VERIFY( ssz.str() == LR"([zzzzzz"PQ \"RS\" TU"])" ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc index e7280acbd..864173235 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc @@ -44,6 +44,16 @@ test01() VERIFY(regex_match_debug("_az", regex("\\w*"))); VERIFY(regex_match_debug("!@#$%", regex("\\W*"))); VERIFY(!regex_match_debug("_01234", regex("\\W*"))); + + VERIFY(regex_match_debug("01", regex("[\\d]*"))); + VERIFY(regex_match_debug("asdfjkl", regex("[\\D]*"))); + VERIFY(!regex_match_debug("asdfjkl0", regex("[\\D]*"))); + VERIFY(regex_match_debug("\r\t\v\f ", regex("[\\s]*"))); + VERIFY(regex_match_debug("asdfjkl", regex("[\\S]*"))); + VERIFY(!regex_match_debug("asdfjkl\r", regex("[\\S]*"))); + VERIFY(regex_match_debug("_az", regex("[\\w]*"))); + VERIFY(regex_match_debug("!@#$%", regex("[\\W]*"))); + VERIFY(!regex_match_debug("_01234", regex("[\\W]*"))); } int diff --git a/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc b/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc index 5670cbb8e..8243eea93 100644 --- a/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc +++ b/gcc-4.9/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc @@ -21,7 +21,10 @@ // Tests multiple consecutive quantifiers #include <regex> +#include <testsuite_hooks.h> +#include <testsuite_regex.h> +using namespace __gnu_test; using namespace std; int @@ -29,5 +32,6 @@ main() { regex re1("a++"); regex re2("(a+)+"); + VERIFY(regex_match_debug("aa", regex("(a)*{3}"))); return 0; } diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/promise/60966.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/promise/60966.cc new file mode 100644 index 000000000..269268b98 --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/promise/60966.cc @@ -0,0 +1,67 @@ +// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } +// { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-require-cstdint "" } +// { dg-require-gthreads "" } +// { dg-require-atomic-builtins "" } + +// 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++/60966 +// This test hangs if std::promise::~promise() destroys the +// shared state before std::promise::set_value() finishes using it. + +#include <future> +#include <thread> +#include <vector> + +const int THREADS = 10; + +void run_task(std::promise<void>* pr) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + pr->set_value(); +} + +int main() +{ + std::vector<std::promise<void>*> tasks(THREADS); + std::vector<std::thread> threads(THREADS); + std::vector<std::future<void>> futures(THREADS); + + for (int i = 0; i < THREADS; ++i) + { + std::promise<void>* task = new std::promise<void>; + tasks[i] = task; + futures[i] = task->get_future(); + threads[i] = std::thread(run_task, task); + } + + for (int i = 0; i < THREADS; ++i) + { + // the temporary future releases the state as soon as wait() returns + std::future<void>(std::move(futures[i])).wait(); + // state is ready, should now be safe to delete promise, so it + // releases the shared state too + delete tasks[i]; + } + + for (auto& t : threads) + t.join(); +} diff --git a/gcc-4.9/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc b/gcc-4.9/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc new file mode 100644 index 000000000..e94bea6ec --- /dev/null +++ b/gcc-4.9/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc @@ -0,0 +1,92 @@ +// If you modify this, please update simple.cc and debug.cc as well. + +// { dg-do run } +// { dg-options "-g -O0 -std=gnu++11" } + +// 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 <string> +#include <deque> +#include <bitset> +#include <iostream> +#include <list> +#include <map> +#include <set> +#include <ext/slist> + +int +main() +{ + std::string tem; + std::string str = "zardoz"; +// { dg-final { note-test str "\"zardoz\"" } } + + std::bitset<10> bs; + bs[0] = 1; + bs[5] = 1; + bs[7] = 1; +// { dg-final { note-test bs {std::bitset = {[0] = 1, [5] = 1, [7] = 1}} } } + + std::deque<std::string> deq; + deq.push_back("one"); + deq.push_back("two"); +// { dg-final { note-test deq {std::deque with 2 elements = {"one", "two"}} } } + + std::deque<std::string>::iterator deqiter = deq.begin(); +// { dg-final { note-test deqiter {"one"} } } + + std::list<std::string> lst; + lst.push_back("one"); + lst.push_back("two"); +// { dg-final { note-test lst {std::list = {[0] = "one", [1] = "two"}} } } + + std::list<std::string>::iterator lstiter = lst.begin(); + tem = *lstiter; +// { dg-final { note-test lstiter {"one"}} } + + std::list<std::string>::const_iterator lstciter = lst.begin(); + tem = *lstciter; +// { dg-final { note-test lstciter {"one"}} } + + std::map<std::string, int> mp; + mp["zardoz"] = 23; +// { dg-final { note-test mp {std::map with 1 elements = {["zardoz"] = 23}} } } + + std::map<std::string, int>::iterator mpiter = mp.begin(); +// { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } } + + std::set<std::string> sp; + sp.insert("clownfish"); + sp.insert("barrel"); +// { dg-final { note-test sp {std::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } } + + std::set<std::string>::const_iterator spciter = sp.begin(); +// { dg-final { note-test spciter {"barrel"} } } + + __gnu_cxx::slist<int> sll; + sll.push_front(23); + sll.push_front(47); +// { dg-final { note-test sll {__gnu_cxx::slist = {[0] = 47, [1] = 23}} } } + + __gnu_cxx::slist<int>::iterator slliter = sll.begin(); +// { dg-final { note-test slliter {47} } } + + return 0; // Mark SPOT +} + +// { dg-final { gdb-test SPOT } } |