From patchwork Thu Aug 9 23:20:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 955895 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-483485-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="GyIqF2P2"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41mkl522DNz9s4b for ; Fri, 10 Aug 2018 09:20:47 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=ckA8uMFi+RvzXi+R0lablAfZ5lu79V98fyBDssdcv/Nm0Kxjoy93x qEOupeaoP7lH/2yLR9gXfSPZ4757GO7bQkzCU//v8VgsCnk0Q9U5PGWHug6jfCf7 nCZNIpU0oq7D4S4ZhdMHy6RVA4+kWVRmh6w1R8k/cBew2yfgHzbAU4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=qysNtIJkilvv/8VLB5XCUB4S4Io=; b=GyIqF2P2ZLUXhZSGPIiw z90QBXMZtkPGn1mh4Ex34lbeDBb/XXXmFn0GuTipWP4JrQwbH+WJy71adgKxXlTj 6/1Plt+lXubyLiNvZVBZWwS4W8CHqeMkWkhSSwMxcGW6hGGOMr9dfyUKOwDSquJs iIrwGe0uUIYF8mH1ZL4kraI= Received: (qmail 67823 invoked by alias); 9 Aug 2018 23:20:38 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 67792 invoked by uid 89); 9 Aug 2018 23:20:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=top-level, _pred, _Pred, UD:tcc X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Aug 2018 23:20:33 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9CBEF3004438; Thu, 9 Aug 2018 23:20:31 +0000 (UTC) Received: from localhost (ovpn-117-178.phx2.redhat.com [10.3.117.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id 076DC614CF; Thu, 9 Aug 2018 23:20:30 +0000 (UTC) Date: Fri, 10 Aug 2018 00:20:29 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Define aliases for containers using polymorphic_allocator Message-ID: <20180809232029.GA17994@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.2 (2017-12-15) These aliases are placed in the top-level header, e.g. not . This ensures that they refer to whichever of std::vector or __debug::vector or __profile::vector is in use when the header is included. * include/std/deque (std::pmr::deque): Declare alias. * include/std/forward_list (std::pmr::forward_list): Likewise. * include/std/list (std::pmr::list): Likewise. * include/std/map (std::pmr::map, std::pmr::multimap): Likewise. * include/std/regex (std::pmr::match_results, std::pmr::cmatch) (std::pmr::smatch, std::pmr::wcmatch, std::pmr::wsmatch): Likewise. * include/std/set (std::pmr::set, std::pmr::multiset): Likewise. * include/std/string (std::pmr::basic_string, std::pmr::string) (std::pmr::u16string, std::pmr::u32string, std::pmr::wstring): Likewise. * include/std/unordered_map (std::pmr::unordered_map) (std::pmr::unordered_multimap): Likewise. * include/std/unordered_set (std::pmr::unordered_set) (std::pmr::unordered_multiset): Likewise. * include/std/vector (std::pmr::vector): Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: New test. * testsuite/23_containers/deque/types/pmr_typedefs.cc: New test. * testsuite/23_containers/forward_list/pmr_typedefs.cc: New test. * testsuite/23_containers/list/pmr_typedefs.cc: New test. * testsuite/23_containers/map/pmr_typedefs.cc: New test. * testsuite/23_containers/multimap/pmr_typedefs.cc: New test. * testsuite/23_containers/multiset/pmr_typedefs.cc: New test. * testsuite/23_containers/set/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_map/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_set/pmr_typedefs.cc: New test. * testsuite/23_containers/vector/pmr_typedefs.cc: New test. * testsuite/28_regex/match_results/pmr_typedefs.cc: New test. Tested x86_64-linux, committed to trunk. commit e7d07f1b8a628402d8a27ba382c66c461a4973a1 Author: Jonathan Wakely Date: Thu Aug 9 22:16:33 2018 +0100 Define aliases for containers using polymorphic_allocator These aliases are placed in the top-level header, e.g. not . This ensures that they refer to whichever of std::vector or __debug::vector or __profile::vector is in use when the header is included. * include/std/deque (std::pmr::deque): Declare alias. * include/std/forward_list (std::pmr::forward_list): Likewise. * include/std/list (std::pmr::list): Likewise. * include/std/map (std::pmr::map, std::pmr::multimap): Likewise. * include/std/regex (std::pmr::match_results, std::pmr::cmatch) (std::pmr::smatch, std::pmr::wcmatch, std::pmr::wsmatch): Likewise. * include/std/set (std::pmr::set, std::pmr::multiset): Likewise. * include/std/string (std::pmr::basic_string, std::pmr::string) (std::pmr::u16string, std::pmr::u32string, std::pmr::wstring): Likewise. * include/std/unordered_map (std::pmr::unordered_map) (std::pmr::unordered_multimap): Likewise. * include/std/unordered_set (std::pmr::unordered_set) (std::pmr::unordered_multiset): Likewise. * include/std/vector (std::pmr::vector): Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: New test. * testsuite/23_containers/deque/types/pmr_typedefs.cc: New test. * testsuite/23_containers/forward_list/pmr_typedefs.cc: New test. * testsuite/23_containers/list/pmr_typedefs.cc: New test. * testsuite/23_containers/map/pmr_typedefs.cc: New test. * testsuite/23_containers/multimap/pmr_typedefs.cc: New test. * testsuite/23_containers/multiset/pmr_typedefs.cc: New test. * testsuite/23_containers/set/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_map/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_set/pmr_typedefs.cc: New test. * testsuite/23_containers/vector/pmr_typedefs.cc: New test. * testsuite/28_regex/match_results/pmr_typedefs.cc: New test. diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque index 896ec8aade0..d2c75f1f078 100644 --- a/libstdc++-v3/include/std/deque +++ b/libstdc++-v3/include/std/deque @@ -73,4 +73,18 @@ # include #endif +#if __cplusplus >= 201703L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr + { + template class polymorphic_allocator; + template + using deque = std::deque<_Tp, polymorphic_allocator<_Tp>>; + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 + #endif /* _GLIBCXX_DEQUE */ diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list index fd4cfe53179..00b41354c7d 100644 --- a/libstdc++-v3/include/std/forward_list +++ b/libstdc++-v3/include/std/forward_list @@ -47,6 +47,19 @@ # include #endif +#if __cplusplus >= 201703L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr + { + template class polymorphic_allocator; + template + using forward_list = std::forward_list<_Tp, polymorphic_allocator<_Tp>>; + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 #endif // C++11 #endif // _GLIBCXX_FORWARD_LIST diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list index 6ba1363b84d..555371ffb76 100644 --- a/libstdc++-v3/include/std/list +++ b/libstdc++-v3/include/std/list @@ -71,5 +71,17 @@ # include #endif +#if __cplusplus >= 201703L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr + { + template class polymorphic_allocator; + template + using list = std::list<_Tp, polymorphic_allocator<_Tp>>; + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 #endif /* _GLIBCXX_LIST */ - diff --git a/libstdc++-v3/include/std/map b/libstdc++-v3/include/std/map index 5c429f00c0b..84f8cdb701d 100644 --- a/libstdc++-v3/include/std/map +++ b/libstdc++-v3/include/std/map @@ -70,4 +70,24 @@ # include #endif +#if __cplusplus >= 201703L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr + { + template class polymorphic_allocator; + template> + using map + = std::map<_Key, _Tp, _Cmp, + polymorphic_allocator>>; + template> + using multimap + = std::multimap<_Key, _Tp, _Cmp, + polymorphic_allocator>>; + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 + #endif /* _GLIBCXX_MAP */ diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex index 7e4564a3783..f0dfa3f68ab 100644 --- a/libstdc++-v3/include/std/regex +++ b/libstdc++-v3/include/std/regex @@ -62,6 +62,27 @@ #include #include +#if __cplusplus >= 201703L +#include +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr { + template class polymorphic_allocator; + template + using match_results + = std::match_results<_BidirectionalIterator, polymorphic_allocator< + sub_match<_BidirectionalIterator>>>; + using cmatch = match_results; + using smatch = match_results; +#ifdef _GLIBCXX_USE_WCHAR_T + using wcmatch = match_results; + using wsmatch = match_results; +#endif + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 #endif // C++11 #endif // _GLIBCXX_REGEX diff --git a/libstdc++-v3/include/std/set b/libstdc++-v3/include/std/set index 732c6d33f08..dd41b2f1911 100644 --- a/libstdc++-v3/include/std/set +++ b/libstdc++-v3/include/std/set @@ -70,4 +70,20 @@ # include #endif +#if __cplusplus >= 201703L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr + { + template class polymorphic_allocator; + template> + using set = std::set<_Key, _Cmp, polymorphic_allocator<_Key>>; + template> + using multiset = std::multiset<_Key, _Cmp, polymorphic_allocator<_Key>>; + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 + #endif /* _GLIBCXX_SET */ diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string index 2fceead30a8..d3cc03aa179 100644 --- a/libstdc++-v3/include/std/string +++ b/libstdc++-v3/include/std/string @@ -52,4 +52,24 @@ #include #include +#if __cplusplus >= 201703L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr { + template class polymorphic_allocator; + template> + using basic_string = std::basic_string<_CharT, _Traits, + polymorphic_allocator<_CharT>>; + using string = basic_string; + using u16string = basic_string; + using u32string = basic_string; +#ifdef _GLIBCXX_USE_WCHAR_T + using wstring = basic_string; +#endif + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 + #endif /* _GLIBCXX_STRING */ diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map index 85840fc49cd..fc1b1e3c71c 100644 --- a/libstdc++-v3/include/std/unordered_map +++ b/libstdc++-v3/include/std/unordered_map @@ -55,6 +55,27 @@ # include #endif +#if __cplusplus >= 201703L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr + { + template class polymorphic_allocator; + template, + typename _Pred = std::equal_to<_Key>> + using unordered_map + = std::unordered_map<_Key, _Tp, _Hash, _Pred, + polymorphic_allocator>>; + template, + typename _Pred = std::equal_to<_Key>> + using unordered_multimap + = std::unordered_multimap<_Key, _Tp, _Hash, _Pred, + polymorphic_allocator>>; + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 #endif // C++11 #endif // _GLIBCXX_UNORDERED_MAP diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set index 0593fbd1b61..8c04669a46e 100644 --- a/libstdc++-v3/include/std/unordered_set +++ b/libstdc++-v3/include/std/unordered_set @@ -54,6 +54,28 @@ #ifdef _GLIBCXX_PROFILE # include #endif + +#if __cplusplus >= 201703L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr + { + template class polymorphic_allocator; + template, + typename _Pred = std::equal_to<_Key>> + using unordered_set + = std::unordered_set<_Key, _Hash, _Pred, + polymorphic_allocator<_Key>>; + template, + typename _Pred = std::equal_to<_Key>> + using unordered_multiset + = std::unordered_multiset<_Key, _Hash, _Pred, + polymorphic_allocator<_Key>>; + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 #endif // C++11 #endif // _GLIBCXX_UNORDERED_SET diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector index e03e50f9c9a..2a421c631f1 100644 --- a/libstdc++-v3/include/std/vector +++ b/libstdc++-v3/include/std/vector @@ -77,5 +77,17 @@ # include #endif -#endif /* _GLIBCXX_VECTOR */ +#if __cplusplus >= 201703L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr { + template class polymorphic_allocator; + template + using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 +#endif /* _GLIBCXX_VECTOR */ diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc b/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc new file mode 100644 index 00000000000..d20fc42901e --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc @@ -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 +// . + +// { dg-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct T : std::char_traits { }; + +static_assert(std::is_same_v, + std::basic_string, + std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::basic_string>>); + +static_assert(std::is_same_v, + std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::pmr::polymorphic_allocator>>); + +#ifdef _GLIBCXX_USE_WCHAR_T +static_assert(std::is_same_v, + std::basic_string, + std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::basic_string>>); + +static_assert(std::is_same_v, + std::pmr::polymorphic_allocator>>); +#endif diff --git a/libstdc++-v3/testsuite/23_containers/deque/types/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/deque/types/pmr_typedefs.cc new file mode 100644 index 00000000000..cd51626d35b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/types/pmr_typedefs.cc @@ -0,0 +1,27 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct X { }; + +static_assert(std::is_same_v, + std::deque>>); diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/forward_list/pmr_typedefs.cc new file mode 100644 index 00000000000..7bf61fac5f1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/pmr_typedefs.cc @@ -0,0 +1,27 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct X { }; + +static_assert(std::is_same_v, + std::forward_list>>); diff --git a/libstdc++-v3/testsuite/23_containers/list/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/list/pmr_typedefs.cc new file mode 100644 index 00000000000..3359295ea33 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/pmr_typedefs.cc @@ -0,0 +1,27 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct X { }; + +static_assert(std::is_same_v, + std::list>>); diff --git a/libstdc++-v3/testsuite/23_containers/map/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/map/pmr_typedefs.cc new file mode 100644 index 00000000000..1a49272b30c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/pmr_typedefs.cc @@ -0,0 +1,33 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct X { }; +struct Y { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same_v, + std::map, + std::pmr::polymorphic_allocator>>>); +static_assert(std::is_same_v, + std::map>>>); diff --git a/libstdc++-v3/testsuite/23_containers/multimap/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/multimap/pmr_typedefs.cc new file mode 100644 index 00000000000..f1dc01e3393 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/pmr_typedefs.cc @@ -0,0 +1,33 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct X { }; +struct Y { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same_v, + std::multimap, + std::pmr::polymorphic_allocator>>>); +static_assert(std::is_same_v, + std::multimap>>>); diff --git a/libstdc++-v3/testsuite/23_containers/multiset/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/multiset/pmr_typedefs.cc new file mode 100644 index 00000000000..224d8821a27 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/pmr_typedefs.cc @@ -0,0 +1,30 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct X { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same_v, + std::multiset, std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::multiset>>); diff --git a/libstdc++-v3/testsuite/23_containers/set/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/set/pmr_typedefs.cc new file mode 100644 index 00000000000..f041c853118 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/pmr_typedefs.cc @@ -0,0 +1,30 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct X { }; +struct Cmp { bool operator()(X, X) const { return false; } }; + +static_assert(std::is_same_v, + std::set, std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::set>>); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/pmr_typedefs.cc new file mode 100644 index 00000000000..c628539663e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/pmr_typedefs.cc @@ -0,0 +1,37 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +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_v, + std::unordered_map, std::equal_to, + std::pmr::polymorphic_allocator>>>); +static_assert(std::is_same_v, + std::unordered_map, + std::pmr::polymorphic_allocator>>>); +static_assert(std::is_same_v, + std::unordered_map>>>); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/pmr_typedefs.cc new file mode 100644 index 00000000000..849b5ab71e7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/pmr_typedefs.cc @@ -0,0 +1,37 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +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_v, + std::unordered_multimap, std::equal_to, + std::pmr::polymorphic_allocator>>>); +static_assert(std::is_same_v, + std::unordered_multimap, + std::pmr::polymorphic_allocator>>>); +static_assert(std::is_same_v, + std::unordered_multimap>>>); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/pmr_typedefs.cc new file mode 100644 index 00000000000..c4eaaf5c7b7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/pmr_typedefs.cc @@ -0,0 +1,36 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +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_v, + std::unordered_multiset, std::equal_to, + std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::unordered_multiset, + std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::unordered_multiset>>); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/pmr_typedefs.cc new file mode 100644 index 00000000000..ecd38235657 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/pmr_typedefs.cc @@ -0,0 +1,36 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +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_v, + std::unordered_set, std::equal_to, + std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::unordered_set, + std::pmr::polymorphic_allocator>>); +static_assert(std::is_same_v, + std::unordered_set>>); diff --git a/libstdc++-v3/testsuite/23_containers/vector/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/vector/pmr_typedefs.cc new file mode 100644 index 00000000000..d2f60febe8d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/pmr_typedefs.cc @@ -0,0 +1,27 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct X { }; + +static_assert(std::is_same_v, + std::vector>>); diff --git a/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc b/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc new file mode 100644 index 00000000000..23aef39caf3 --- /dev/null +++ b/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc @@ -0,0 +1,44 @@ +// 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-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + +struct X; +static_assert(std::is_same_v, + std::match_results>>>); + +static_assert(std::is_same_v>>>); +static_assert(std::is_same_v>>>); +#ifdef _GLIBCXX_USE_WCHAR_T +static_assert(std::is_same_v>>>); +static_assert(std::is_same_v>>>); +#endif