[libcxx-commits] [PATCH] D63050: Test that correct value category is used in scoped_allocator_adaptor::construct

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 23 09:16:29 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG278c00c4ff8b: [libc++] [NFC] Test that correct value category is used in… (authored by zoecarver).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63050/new/

https://reviews.llvm.org/D63050

Files:
  libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
  libcxx/www/cxx1z_status.html


Index: libcxx/www/cxx1z_status.html
===================================================================
--- libcxx/www/cxx1z_status.html
+++ libcxx/www/cxx1z_status.html
@@ -308,7 +308,7 @@
 	<tr><td><a href="https://wg21.link/LWG2582">2582</a></td><td>§[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&)</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>
Index: libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
===================================================================
--- libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
+++ libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
@@ -111,6 +111,18 @@
 
 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**)
 {
 
@@ -185,6 +197,17 @@
         assert(A3<F>::constructed);
         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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63050.252072.patch
Type: text/x-patch
Size: 2600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200323/0724f91d/attachment-0001.bin>


More information about the libcxx-commits mailing list