From: Jonathan Wakely Date: Fri, 12 Oct 2018 12:51:29 +0000 (+0100) Subject: Fix experimental::pmr typedefs and add tests X-Git-Tag: releases/gcc-7.4.0~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82182d876aff148dfb1c1306902353ecd5e20ff9;p=thirdparty%2Fgcc.git Fix experimental::pmr typedefs and add tests The typedefs in and 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-23 Jonathan Wakely * testsuite/21_strings/basic_string/init-list.cc: Require cxx11-abi. * testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc: Likewise. * testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc: Likewise. Backport from mainline 2018-08-22 Jonathan Wakely 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 * 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: r265093 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 95ecf18c689a..e4298de17bf6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,63 @@ +2018-10-12 Jonathan Wakely + + Backport from mainline + 2018-08-23 Jonathan Wakely + + * testsuite/21_strings/basic_string/init-list.cc: + Require cxx11-abi. + * testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc: + Likewise. + * testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc: + Likewise. + + Backport from mainline + 2018-08-22 Jonathan Wakely + + 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 + + * 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 Backport from mainline diff --git a/libstdc++-v3/include/experimental/regex b/libstdc++-v3/include/experimental/regex index 9b5679fc78ef..f0b0dfacfe90 100644 --- a/libstdc++-v3/include/experimental/regex +++ b/libstdc++-v3/include/experimental/regex @@ -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 using match_results @@ -59,10 +59,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 typedef match_results smatch; typedef match_results wsmatch; -_GLIBCXX_END_NAMESPACE_CXX11 _GLIBCXX_END_NAMESPACE_VERSION } // namespace pmr - +#endif } // namespace fundamentals_v2 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/string b/libstdc++-v3/include/experimental/string index 5347991959ee..ff3777c31e2b 100644 --- a/libstdc++-v3/include/experimental/string +++ b/libstdc++-v3/include/experimental/string @@ -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> @@ -82,10 +82,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 typedef basic_string u32string; typedef basic_string 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/21_strings/basic_string/init-list.cc b/libstdc++-v3/testsuite/21_strings/basic_string/init-list.cc index bb390d650a36..8df9d2f06402 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/init-list.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/init-list.cc @@ -17,6 +17,7 @@ // // { dg-do run { target c++11 } } +// { dg-require-effective-target cxx11-abi } #include #include 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 index 000000000000..2b475791bfad --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +namespace xpmr = std::experimental::pmr; + +struct X { }; + +static_assert(std::is_same, + std::deque>>::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 index 000000000000..ac2dd52dff60 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_forward_list.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +namespace xpmr = std::experimental::pmr; + +struct X { }; + +static_assert(std::is_same, + std::forward_list>>::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 index 000000000000..aea5c8061bd8 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +namespace xpmr = std::experimental::pmr; + +struct X { }; + +static_assert(std::is_same, + std::list>>::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 index 000000000000..2074022dc2b7 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Y { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same, + std::map, + xpmr::polymorphic_allocator>>>::value, + "pmr::map"); +static_assert(std::is_same, + std::map>>>::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 index 000000000000..8f5f8513403d --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc @@ -0,0 +1,50 @@ +// 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 +// . + +// { dg-do compile { target c++14 } } +// { dg-require-effective-target cxx11-abi } + +#include + +namespace xpmr = std::experimental::pmr; + +struct X; +static_assert(std::is_same, + std::match_results>>>::value, + "pmr::match_results"); + +static_assert(std::is_same>>>::value, + "pmr::cmatch"); +static_assert(std::is_same>>>::value, + "pmr::smatch"); +#ifdef _GLIBCXX_USE_WCHAR_T +static_assert(std::is_same>>>::value, + "pmr::wcmatch"); +static_assert(std::is_same>>>::value, + "pmr::wsmatch"); +#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 index 000000000000..e6acaf411223 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multimap.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Y { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same, + std::multimap, + xpmr::polymorphic_allocator>>>::value, + "pmr::multimap"); +static_assert(std::is_same, + std::multimap>>>::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 index 000000000000..e98c556c489c --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_multiset.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same, + std::multiset, xpmr::polymorphic_allocator>>::value, + "pmr::multiset"); +static_assert(std::is_same, + std::multiset>>::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 index 000000000000..182a11e9701b --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +namespace xpmr = std::experimental::pmr; + +struct X { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same, + std::set, xpmr::polymorphic_allocator>>::value, + "pmr::set"); +static_assert(std::is_same, + std::set>>::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 index 000000000000..ed53ce1a89b2 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc @@ -0,0 +1,61 @@ +// 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 +// . + +// { dg-do compile { target c++14 } } +// { dg-require-effective-target cxx11-abi } + +#include + +namespace xpmr = std::experimental::pmr; + +struct T : std::char_traits { }; + +static_assert(std::is_same, + std::basic_string, + xpmr::polymorphic_allocator>>::value, + "pmr::basic_string"); +static_assert(std::is_same, + std::basic_string>>::value, + "pmr::basic_string"); + +static_assert(std::is_same, + xpmr::polymorphic_allocator>>::value, + "pmr::string"); +static_assert(std::is_same, + xpmr::polymorphic_allocator>>::value, + "pmr::u16string"); +static_assert(std::is_same, + xpmr::polymorphic_allocator>>::value, + "pmr::u32string"); + +#ifdef _GLIBCXX_USE_WCHAR_T +static_assert(std::is_same, + std::basic_string, + xpmr::polymorphic_allocator>>::value, + "pmr::basic_string"); +static_assert(std::is_same, + std::basic_string>>::value, + "pmr::basic_string"); + +static_assert(std::is_same, + xpmr::polymorphic_allocator>>::value, + "pmr::wstring"); +#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 index 000000000000..15e00e7e720c --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_map.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +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, + std::unordered_map, std::equal_to, + xpmr::polymorphic_allocator>>>::value, + "pmr::unordered_map"); +static_assert(std::is_same, + std::unordered_map, + xpmr::polymorphic_allocator>>>::value, + "pmr::unordered_map"); +static_assert(std::is_same, + std::unordered_map>>>::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 index 000000000000..67054ffb4c9c --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multimap.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +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, + std::unordered_multimap, std::equal_to, + xpmr::polymorphic_allocator>>>::value, + "pmr::unordered_multimap"); +static_assert(std::is_same, + std::unordered_multimap, + xpmr::polymorphic_allocator>>>::value, + "pmr::unordered_multimap"); +static_assert(std::is_same, + std::unordered_multimap>>>::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 index 000000000000..aaba4d3ec473 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_multiset.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +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, + std::unordered_multiset, std::equal_to, + xpmr::polymorphic_allocator>>::value, + "pmr::unordered_multiset"); +static_assert(std::is_same, + std::unordered_multiset, + xpmr::polymorphic_allocator>>::value, + "pmr::unordered_multiset"); +static_assert(std::is_same, + std::unordered_multiset>>::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 index 000000000000..b90051ec0747 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_unordered_set.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +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, + std::unordered_set, std::equal_to, + xpmr::polymorphic_allocator>>::value, + "pmr::unordered_set"); +static_assert(std::is_same, + std::unordered_set, + xpmr::polymorphic_allocator>>::value, + "pmr::unordered_set"); +static_assert(std::is_same, + std::unordered_set>>::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 index 000000000000..f780aa5666b0 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc @@ -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 +// . + +// { dg-do compile { target c++14 } } + +#include + +namespace xpmr = std::experimental::pmr; + +struct X { }; + +static_assert(std::is_same, + std::vector>>::value, + "pmr::vector");