libstdc++: Ensure pmr aliases work without <memory_resource>
authorJonathan Wakely <jwakely@redhat.com>
Thu, 19 May 2022 22:38:23 +0000 (23:38 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 19 May 2022 22:38:23 +0000 (23:38 +0100)
commit8ccdc7ce33f5e7ca509e5b9f835ed4719db21ffd
tree35b201acf391285912ba2ad28de5baff3c197b13
parentd863ba23fb16122bb0547b0c678173be0d98f43c
libstdc++: Ensure pmr aliases work without <memory_resource>

Currently the alias templates for std::pmr::vector, std::pmr::string
etc. are defined using a forward declaration for polymorphic_allocator.
This means you can't actually use the alias templates unless you also
include <memory_resource>. The rationale for that is that it's a fairly
large header, and most users don't need it. This isn't uncontroversial
though, and LWG 3681 questions whether it's even conforming.

This change adds a new <bits/memory_resource.h> header with the minimum
needed to use polymorphic_allocator and the std::pmr container aliases.
Including <memory_resource> is still necessary to use the program-wide
resource objects, or the pool resources or monotonic buffer resource.

libstdc++-v3/ChangeLog:

* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/bits/memory_resource.h: New file.
* include/std/deque: Include <bits/memory_resource.h>.
* include/std/forward_list: Likewise.
* include/std/list: Likewise.
* include/std/map: Likewise.
* include/std/memory_resource (pmr::memory_resource): Move to
new <bits/memory_resource.h> header.
(pmr::polymorphic_allocator): Likewise.
* include/std/regex: Likewise.
* include/std/set: Likewise.
* include/std/stacktrace: Likewise.
* include/std/string: Likewise.
* include/std/unordered_map: Likewise.
* include/std/unordered_set: Likewise.
* include/std/vector: Likewise.
* testsuite/21_strings/basic_string/types/pmr_typedefs.cc:
Remove <memory_resource> header and check construction.
* testsuite/23_containers/deque/types/pmr_typedefs.cc: Likewise.
* testsuite/23_containers/forward_list/pmr_typedefs.cc:
Likewise.
* testsuite/23_containers/list/pmr_typedefs.cc: Likewise.
* testsuite/23_containers/map/pmr_typedefs.cc: Likewise.
* testsuite/23_containers/multimap/pmr_typedefs.cc: Likewise.
* testsuite/23_containers/multiset/pmr_typedefs.cc: Likewise.
* testsuite/23_containers/set/pmr_typedefs.cc: Likewise.
* testsuite/23_containers/unordered_map/pmr_typedefs.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/pmr_typedefs.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/pmr_typedefs.cc:
Likewise.
* testsuite/23_containers/unordered_set/pmr_typedefs.cc:
Likewise.
* testsuite/23_containers/vector/pmr_typedefs.cc: Likewise.
* testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/variadic-tuple.C: Qualify function to avoid ADL
finding std::make_tuple.
30 files changed:
gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/memory_resource.h [new file with mode: 0644]
libstdc++-v3/include/std/deque
libstdc++-v3/include/std/forward_list
libstdc++-v3/include/std/list
libstdc++-v3/include/std/map
libstdc++-v3/include/std/memory_resource
libstdc++-v3/include/std/regex
libstdc++-v3/include/std/set
libstdc++-v3/include/std/stacktrace
libstdc++-v3/include/std/string
libstdc++-v3/include/std/unordered_map
libstdc++-v3/include/std/unordered_set
libstdc++-v3/include/std/vector
libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/deque/types/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/forward_list/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/list/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/map/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/multimap/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/multiset/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/set/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/unordered_map/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/unordered_multiset/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/unordered_set/pmr_typedefs.cc
libstdc++-v3/testsuite/23_containers/vector/pmr_typedefs.cc
libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc