[libc++] [NFC] Test that correct value category is used in scoped_allocator_adaptor::construct

This patch fixes 2586. Just tests. NFC.

Differential Revision: https://reviews.llvm.org/D63050
This commit is contained in:
zoecarver 2020-03-23 09:05:47 -07:00
parent 596da62d21
commit 278c00c4ff
2 changed files with 24 additions and 1 deletions

View File

@ -111,6 +111,18 @@ struct F
bool F::constructed = false;
struct G
{
static bool constructed;
typedef std::allocator<G> allocator_type;
G(std::allocator_arg_t, allocator_type&&) { assert(false); }
G(allocator_type&) { constructed = true; }
};
bool G::constructed = false;
int main(int, char**)
{
@ -186,5 +198,16 @@ int main(int, char**)
s->~S();
}
// LWG 2586
// Test that is_constructible uses an lvalue ref so the correct constructor
// is picked.
{
std::scoped_allocator_adaptor<G::allocator_type> sa;
G* ptr = sa.allocate(1);
sa.construct(ptr);
assert(G::constructed);
sa.deallocate(ptr, 1);
}
return 0;
}

View File

@ -308,7 +308,7 @@
<tr><td><a href="https://wg21.link/LWG2582">2582</a></td><td>&sect;[res.on.functions]/2's prohibition against incomplete types shouldn't apply to type traits</td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2583">2583</a></td><td>There is no way to supply an allocator for <tt>basic_string(str, pos)</tt></td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2585">2585</a></td><td><tt>forward_list::resize(size_type, const value_type&amp;)</tt> effects incorrect</td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2586">2586</a></td><td>Wrong value category used in <tt>scoped_allocator_adaptor::construct()</tt></td><td>Jacksonville</td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG2586">2586</a></td><td>Wrong value category used in <tt>scoped_allocator_adaptor::construct()</tt></td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2590">2590</a></td><td>Aggregate initialization for <tt>std::array</tt></td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td></td><td></td><td></td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG2181">2181</a></td><td>Exceptions from seed sequence operations</td><td>Oulu</td><td>Complete</td></tr>