aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/std/ranges
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/std/ranges')
-rw-r--r--libstdc++-v3/testsuite/std/ranges/conv/1.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/std/ranges/conv/1.cc b/libstdc++-v3/testsuite/std/ranges/conv/1.cc
index 231cb9d..2caa1b8 100644
--- a/libstdc++-v3/testsuite/std/ranges/conv/1.cc
+++ b/libstdc++-v3/testsuite/std/ranges/conv/1.cc
@@ -12,6 +12,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
#include <testsuite_iterators.h>
+#include <unordered_map>
void
test_p1206r7_examples()
@@ -478,6 +479,26 @@ test_pr119282()
return true;
}
+void
+test_lwg2713()
+{
+ using Alloc = __gnu_test::uneq_allocator<std::pair<const int, const char*>>;
+ const Alloc alloc(303);
+ const std::map<int, const char*> m{{1, "one"}, {2, "two"}, {3, "three"}};
+ namespace ranges = std::ranges;
+
+ // Call constructors with bucket count
+ auto m1 = m | ranges::to<std::unordered_map>(0, alloc);
+ VERIFY( m1.get_allocator() == alloc );
+ auto m2 = m | ranges::to<std::unordered_multimap>(0, alloc);
+ VERIFY( m2.get_allocator() == alloc );
+ // These call constructors added in lwg2713
+ auto m3 = m | ranges::to<std::unordered_map>(alloc);
+ VERIFY( m3.get_allocator() == alloc );
+ auto m4 = m | ranges::to<std::unordered_multimap>(alloc);
+ VERIFY( m4.get_allocator() == alloc );
+}
+
int main()
{
test_p1206r7_examples();
@@ -487,6 +508,7 @@ int main()
test_2_1_3();
test_2_1_4();
test_2_2();
+ test_lwg2713();
test_lwg3984();
test_nodiscard();
test_constexpr();