]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix experimental::pmr typedefs and add tests
authorJonathan Wakely <jwakely@redhat.com>
Fri, 12 Oct 2018 13:04:38 +0000 (14:04 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 12 Oct 2018 13:04:38 +0000 (14:04 +0100)
The typedefs in <experimental/regex> and <experimental/string> don't
need to be in the __cxx11 namespace, because they are only aliases and
so will have the same mangled name as the underlying types.

Backport from mainline
2018-08-22  Jonathan Wakely  <jwakely@redhat.com>

PR libstdc++/87061
* include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::match_results, experimental::pmr::cmatch)
(experimental::pmr::smatch, experimental::pmr::wcmatch)
(experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
because COW strings don't support C++11 allocator model.
* include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::basic_string, experimental::pmr::string)
(experimental::pmr::u16string, experimental::pmr::u32string)
(experimental::pmr::wstring): Likewise.

Backport from mainline
2018-08-15  Jonathan Wakely  <jwakely@redhat.com>

* include/experimental/regex: Remove begin/end macros for namespace.
* include/experimental/string: Likewise.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc:
New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_forward_list.cc: New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc:
New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc:
New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc:
New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_multimap.cc: New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_multiset.cc: New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc:
New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_unordered_map.cc: New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_unordered_multimap.cc: New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_unordered_multiset.cc: New test.
* testsuite/experimental/polymorphic_allocator/
pmr_typedefs_unordered_set.cc: New test.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc:
New test.

From-SVN: r265098

17 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/regex
libstdc++-v3/include/experimental/string
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_forward_list.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multimap.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multiset.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_map.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multimap.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multiset.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_set.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc [new file with mode: 0644]

index 51c7c1a36d36262064534b3e0eb075fbbf8303f2..f5764441f0b0545c75e957166e83277a11d4a703 100644 (file)
@@ -1,3 +1,53 @@
+2018-10-12  Jonathan Wakely  <jwakely@redhat.com>
+
+       Backport from mainline
+       2018-08-22  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/87061
+       * include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
+       (experimental::pmr::match_results, experimental::pmr::cmatch)
+       (experimental::pmr::smatch, experimental::pmr::wcmatch)
+       (experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
+       because COW strings don't support C++11 allocator model.
+       * include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
+       (experimental::pmr::basic_string, experimental::pmr::string)
+       (experimental::pmr::u16string, experimental::pmr::u32string)
+       (experimental::pmr::wstring): Likewise.
+
+       Backport from mainline
+       2018-08-15  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/experimental/regex: Remove begin/end macros for namespace.
+       * include/experimental/string: Likewise.
+       * testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc:
+       New test.
+       * testsuite/experimental/polymorphic_allocator/
+       pmr_typedefs_forward_list.cc: New test.
+       * testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc:
+       New test.
+       * testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc:
+       New test.
+       * testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc:
+       New test.
+       * testsuite/experimental/polymorphic_allocator/
+       pmr_typedefs_multimap.cc: New test.
+       * testsuite/experimental/polymorphic_allocator/
+       pmr_typedefs_multiset.cc: New test.
+       * testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc:
+       New test.
+       * testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
+       New test.
+       * testsuite/experimental/polymorphic_allocator/
+       pmr_typedefs_unordered_map.cc: New test.
+       * testsuite/experimental/polymorphic_allocator/
+       pmr_typedefs_unordered_multimap.cc: New test.
+       * testsuite/experimental/polymorphic_allocator/
+       pmr_typedefs_unordered_multiset.cc: New test.
+       * testsuite/experimental/polymorphic_allocator/
+       pmr_typedefs_unordered_set.cc: New test.
+       * testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc:
+       New test.
+
 2018-10-12  Jonathan Wakely  <jwakely@redhat.com>
 
        Backport from mainline
index 1feab780e7bb662ff7512895d3b02d3bcaff014e..a0f2e063189b6dac3f1ba466be1700458c8e0bfb 100644 (file)
@@ -44,10 +44,10 @@ namespace experimental
 {
 inline namespace fundamentals_v2
 {
+#if _GLIBCXX_USE_CXX11_ABI
 namespace pmr
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
-_GLIBCXX_BEGIN_NAMESPACE_CXX11
 
   template<typename _BidirectionalIterator>
     using match_results
@@ -59,10 +59,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
   typedef match_results<string::const_iterator> smatch;
   typedef match_results<wstring::const_iterator> wsmatch;
 
-_GLIBCXX_END_NAMESPACE_CXX11
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace pmr
-
+#endif
 } // namespace fundamentals_v2
 } // namespace experimental
 } // namespace std
index 3bd00d5dbc29f2c30ae49028cbb2c39ce0967b75..cd4d06429895e0dbda5b3e373f42f46001161910 100644 (file)
@@ -66,9 +66,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 _GLIBCXX_END_NAMESPACE_VERSION
 
+#if _GLIBCXX_USE_CXX11_ABI
 namespace pmr {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
-_GLIBCXX_BEGIN_NAMESPACE_CXX11
 
   // basic_string using polymorphic allocator in namespace pmr
   template<typename _CharT, typename _Traits = char_traits<_CharT>>
@@ -82,10 +82,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
   typedef basic_string<char32_t> u32string;
   typedef basic_string<wchar_t> wstring;
 
-_GLIBCXX_END_NAMESPACE_CXX11
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace pmr
-
+#endif
 } // namespace fundamentals_v2
 } // namespace experimental
 } // namespace std
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc
new file mode 100644 (file)
index 0000000..2b47579
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/deque>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+
+static_assert(std::is_same<xpmr::deque<X>,
+    std::deque<X, xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::deque");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_forward_list.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_forward_list.cc
new file mode 100644 (file)
index 0000000..ac2dd52
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/forward_list>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+
+static_assert(std::is_same<xpmr::forward_list<X>,
+    std::forward_list<X, xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::forward_list");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc
new file mode 100644 (file)
index 0000000..aea5c80
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/list>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+
+static_assert(std::is_same<xpmr::list<X>,
+    std::list<X, xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::list");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc
new file mode 100644 (file)
index 0000000..2074022
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/map>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+struct Y { };
+struct Cmp { bool operator()(X, X) const { return false; } };
+
+static_assert(std::is_same<xpmr::map<X, Y>,
+    std::map<X, Y, std::less<X>,
+            xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::map");
+static_assert(std::is_same<xpmr::map<X, Y, Cmp>,
+    std::map<X, Y, Cmp,
+            xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::map");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc
new file mode 100644 (file)
index 0000000..f02d215
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+
+#include <experimental/regex>
+
+#if _GLIBCXX_USE_CXX11_ABI
+namespace xpmr = std::experimental::pmr;
+
+struct X;
+static_assert(std::is_same<xpmr::match_results<X*>,
+    std::match_results<X*,
+      xpmr::polymorphic_allocator<std::sub_match<X*>>>>::value,
+    "pmr::match_results");
+
+static_assert(std::is_same<xpmr::cmatch,
+    std::match_results<const char*,
+      xpmr::polymorphic_allocator<std::sub_match<const char*>>>>::value,
+    "pmr::cmatch");
+static_assert(std::is_same<xpmr::smatch,
+    std::match_results<xpmr::string::const_iterator,
+      xpmr::polymorphic_allocator<
+       std::sub_match<xpmr::string::const_iterator>>>>::value,
+    "pmr::smatch");
+#ifdef _GLIBCXX_USE_WCHAR_T
+static_assert(std::is_same<xpmr::wcmatch,
+    std::match_results<const wchar_t*,
+      xpmr::polymorphic_allocator<std::sub_match<const wchar_t*>>>>::value,
+    "pmr::wcmatch");
+static_assert(std::is_same<xpmr::wsmatch,
+    std::match_results<xpmr::wstring::const_iterator,
+      xpmr::polymorphic_allocator<
+       std::sub_match<xpmr::wstring::const_iterator>>>>::value,
+    "pmr::wsmatch");
+#endif
+#endif
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multimap.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multimap.cc
new file mode 100644 (file)
index 0000000..e6acaf4
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/map>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+struct Y { };
+struct Cmp { bool operator()(X, X) const { return false; } };
+
+static_assert(std::is_same<xpmr::multimap<X, Y>,
+    std::multimap<X, Y, std::less<X>,
+                 xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::multimap");
+static_assert(std::is_same<xpmr::multimap<X, Y, Cmp>,
+    std::multimap<X, Y, Cmp,
+                 xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::multimap");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multiset.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multiset.cc
new file mode 100644 (file)
index 0000000..e98c556
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/set>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+struct Cmp { bool operator()(X, X) const { return false; } };
+
+static_assert(std::is_same<xpmr::multiset<X>,
+    std::multiset<X, std::less<X>, xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::multiset");
+static_assert(std::is_same<xpmr::multiset<X, Cmp>,
+    std::multiset<X, Cmp, xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::multiset");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc
new file mode 100644 (file)
index 0000000..182a11e
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/set>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+struct Cmp { bool operator()(X, X) const { return false; } };
+
+static_assert(std::is_same<xpmr::set<X>,
+    std::set<X, std::less<X>, xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::set");
+static_assert(std::is_same<xpmr::set<X, Cmp>,
+    std::set<X, Cmp, xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::set");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc
new file mode 100644 (file)
index 0000000..62e2147
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/string>
+
+#if _GLIBCXX_USE_CXX11_ABI
+namespace xpmr = std::experimental::pmr;
+
+struct T : std::char_traits<char> { };
+
+static_assert(std::is_same<xpmr::basic_string<char>,
+    std::basic_string<char, std::char_traits<char>,
+                     xpmr::polymorphic_allocator<char>>>::value,
+    "pmr::basic_string");
+static_assert(std::is_same<xpmr::basic_string<char, T>,
+    std::basic_string<char, T, xpmr::polymorphic_allocator<char>>>::value,
+    "pmr::basic_string");
+
+static_assert(std::is_same<xpmr::string,
+    std::basic_string<char, std::char_traits<char>,
+                     xpmr::polymorphic_allocator<char>>>::value,
+    "pmr::string");
+static_assert(std::is_same<xpmr::u16string,
+    std::basic_string<char16_t, std::char_traits<char16_t>,
+                     xpmr::polymorphic_allocator<char16_t>>>::value,
+    "pmr::u16string");
+static_assert(std::is_same<xpmr::u32string,
+    std::basic_string<char32_t, std::char_traits<char32_t>,
+                     xpmr::polymorphic_allocator<char32_t>>>::value,
+    "pmr::u32string");
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+static_assert(std::is_same<xpmr::basic_string<wchar_t>,
+    std::basic_string<wchar_t, std::char_traits<wchar_t>,
+                     xpmr::polymorphic_allocator<wchar_t>>>::value,
+    "pmr::basic_string<wchar_t>");
+static_assert(std::is_same<xpmr::basic_string<wchar_t, T>,
+    std::basic_string<wchar_t, T, xpmr::polymorphic_allocator<wchar_t>>>::value,
+    "pmr::basic_string<wchar_t>");
+
+static_assert(std::is_same<xpmr::wstring,
+    std::basic_string<wchar_t, std::char_traits<wchar_t>,
+                     xpmr::polymorphic_allocator<wchar_t>>>::value,
+    "pmr::wstring");
+#endif
+#endif
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_map.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_map.cc
new file mode 100644 (file)
index 0000000..15e00e7
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/unordered_map>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+struct Y { };
+struct Hash { std::size_t operator()(X) const { return 0; } };
+struct Eq { bool operator()(X, X) const { return true; } };
+
+static_assert(std::is_same<xpmr::unordered_map<X, Y>,
+    std::unordered_map<X, Y, std::hash<X>, std::equal_to<X>,
+      xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::unordered_map");
+static_assert(std::is_same<xpmr::unordered_map<X, Y, Hash>,
+    std::unordered_map<X, Y, Hash, std::equal_to<X>,
+      xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::unordered_map");
+static_assert(std::is_same<xpmr::unordered_map<X, Y, Hash, Eq>,
+    std::unordered_map<X, Y, Hash, Eq,
+      xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::unordered_map");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multimap.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multimap.cc
new file mode 100644 (file)
index 0000000..67054ff
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/unordered_map>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+struct Y { };
+struct Hash { std::size_t operator()(X) const { return 0; } };
+struct Eq { bool operator()(X, X) const { return true; } };
+
+static_assert(std::is_same<xpmr::unordered_multimap<X, Y>,
+    std::unordered_multimap<X, Y, std::hash<X>, std::equal_to<X>,
+      xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::unordered_multimap");
+static_assert(std::is_same<xpmr::unordered_multimap<X, Y, Hash>,
+    std::unordered_multimap<X, Y, Hash, std::equal_to<X>,
+      xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::unordered_multimap");
+static_assert(std::is_same<xpmr::unordered_multimap<X, Y, Hash, Eq>,
+    std::unordered_multimap<X, Y, Hash, Eq,
+      xpmr::polymorphic_allocator<std::pair<const X, Y>>>>::value,
+    "pmr::unordered_multimap");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multiset.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multiset.cc
new file mode 100644 (file)
index 0000000..aaba4d3
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/unordered_set>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+struct Hash { std::size_t operator()(X) const { return 0; } };
+struct Eq { bool operator()(X, X) const { return true; } };
+
+static_assert(std::is_same<xpmr::unordered_multiset<X>,
+    std::unordered_multiset<X, std::hash<X>, std::equal_to<X>,
+      xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::unordered_multiset");
+static_assert(std::is_same<xpmr::unordered_multiset<X, Hash>,
+    std::unordered_multiset<X, Hash, std::equal_to<X>,
+      xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::unordered_multiset");
+static_assert(std::is_same<xpmr::unordered_multiset<X, Hash, Eq>,
+    std::unordered_multiset<X, Hash, Eq,
+      xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::unordered_multiset");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_set.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_set.cc
new file mode 100644 (file)
index 0000000..b90051e
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/unordered_set>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+struct Hash { std::size_t operator()(X) const { return 0; } };
+struct Eq { bool operator()(X, X) const { return true; } };
+
+static_assert(std::is_same<xpmr::unordered_set<X>,
+    std::unordered_set<X, std::hash<X>, std::equal_to<X>,
+      xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::unordered_set");
+static_assert(std::is_same<xpmr::unordered_set<X, Hash>,
+    std::unordered_set<X, Hash, std::equal_to<X>,
+      xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::unordered_set");
+static_assert(std::is_same<xpmr::unordered_set<X, Hash, Eq>,
+    std::unordered_set<X, Hash, Eq,
+      xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::unordered_set");
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc
new file mode 100644 (file)
index 0000000..f780aa5
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2018 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-do compile { target c++14 } }
+
+#include <experimental/vector>
+
+namespace xpmr = std::experimental::pmr;
+
+struct X { };
+
+static_assert(std::is_same<xpmr::vector<X>,
+    std::vector<X, xpmr::polymorphic_allocator<X>>>::value,
+    "pmr::vector");