diff options
Diffstat (limited to 'libstdc++-v3')
6 files changed, 102 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6f342566786..f7563d0ad62 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,14 @@ 2014-10-01 Jonathan Wakely <jwakely@redhat.com> + * include/bits/stl_queue.h: Include missing header. + * include/bits/stl_stack.h: Likewise. + * testsuite/23_containers/priority_queue/requirements/ + uses_allocator.cc: New. + * testsuite/23_containers/queue/requirements/uses_allocator.cc: New. + * testsuite/23_containers/stack/requirements/uses_allocator.cc: New. + +2014-10-01 Jonathan Wakely <jwakely@redhat.com> + * include/std/mutex (try_lock): Do not swallow exceptions. * testsuite/30_threads/try_lock/4.cc: Fix test. diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h index b516664b612..32124e34b50 100644 --- a/libstdc++-v3/include/bits/stl_queue.h +++ b/libstdc++-v3/include/bits/stl_queue.h @@ -58,6 +58,9 @@ #include <bits/concept_check.h> #include <debug/debug.h> +#if __cplusplus >= 201103L +# include <bits/uses_allocator.h> +#endif namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h index ee187da8ee3..f4bb72c3891 100644 --- a/libstdc++-v3/include/bits/stl_stack.h +++ b/libstdc++-v3/include/bits/stl_stack.h @@ -58,6 +58,9 @@ #include <bits/concept_check.h> #include <debug/debug.h> +#if __cplusplus >= 201103L +# include <bits/uses_allocator.h> +#endif namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc b/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc new file mode 100644 index 00000000000..efe73aee879 --- /dev/null +++ b/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/libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc b/libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc new file mode 100644 index 00000000000..42106caf8a5 --- /dev/null +++ b/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/libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc b/libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc new file mode 100644 index 00000000000..3663d633b45 --- /dev/null +++ b/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" ); |