Debian Codegraph @

libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc

raw
1 // { dg-do compile { target c++11 } }
2 // { dg-require-effective-target hosted }
3
4 #include <scoped_allocator>
5
6 struct move_only
7 {
8 move_only(move_only&&);
9 };
10
11 using P = std::pair<move_only, move_only>;
12
13 void
14 test_pr108952(std::pair<move_only&&, move_only&&> rvals)
15 {
16 // LWG 3527. uses_allocator_construction_args handles rvalue pairs of
17 // rvalue references incorrectly.
18 // PR libstdc++/108952 Regression in uses_allocator_construction_args
19 // for pair of rvalue references
20 std::scoped_allocator_adaptor<std::allocator<P>> a;
21 auto p = a.allocate(1);
22 a.construct(p, std::move(rvals));
23 a.deallocate(p, 1);
24 }