Include <bits/uses_allocator.h> in <stack> and <queue>.
authorJonathan Wakely <jwakely@redhat.com>
Mon, 22 Sep 2014 16:01:53 +0000 (17:01 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 22 Sep 2014 16:01:53 +0000 (17:01 +0100)
* 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.

From-SVN: r215470

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_queue.h
libstdc++-v3/include/bits/stl_stack.h
libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc [new file with mode: 0644]

index 46efe3227095ec7a5d7aeb16880ce1904bfcd66c..5cd422e4a1191c16f0d5d6abc77d2770490cd2e0 100644 (file)
@@ -1,3 +1,12 @@
+2014-09-22  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-09-22  Jonathan Wakely  <jwakely@redhat.com>
 
        * doc/xml/manual/status_cxx2011.xml: Update C++11 status.
index b516664b61230d2460354a14e0c098a7a3da652e..32124e34b502150ab50122c99aa3eed23a58bd18 100644 (file)
@@ -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)
 {
index ee187da8ee32c37c631db75ea01dcf130da1c56e..f4bb72c3891ae327a76867140dc9bd37610ba7be 100644 (file)
@@ -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 (file)
index 0000000..efe73ae
--- /dev/null
@@ -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 (file)
index 0000000..42106ca
--- /dev/null
@@ -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 (file)
index 0000000..3663d63
--- /dev/null
@@ -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" );