Include <bits/uses_allocator.h> in <stack> and <queue>.
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Sep 2014 16:01:53 +0000 (16:01 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Sep 2014 16:01:53 +0000 (16:01 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215470 138bc75d-0d04-0410-961f-82ee72b054a4

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 46efe32..5cd422e 100644 (file)
@@ -1,5 +1,14 @@
 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.
        * doc/xml/manual/status_cxx2014.xml: Update TS status.
        * doc/html/manual/status.html: Regenerate.
index b516664..32124e3 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 ee187da..f4bb72c 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" );