[libcxx-commits] [libcxx] 278c00c - [libc++] [NFC] Test that correct value category is used in scoped_allocator_adaptor::construct

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 23 09:08:25 PDT 2020


Author: zoecarver
Date: 2020-03-23T09:08:05-07:00
New Revision: 278c00c4ff8b48d9031f94eb8c52655a4f64db7c

URL: https://github.com/llvm/llvm-project/commit/278c00c4ff8b48d9031f94eb8c52655a4f64db7c
DIFF: https://github.com/llvm/llvm-project/commit/278c00c4ff8b48d9031f94eb8c52655a4f64db7c.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp b/libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
index 5201c5c6cab7..201ba2e98113 100644
--- a/libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
+++ b/libcxx/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
@@ -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**)
 {
 
@@ -185,6 +197,17 @@ int main(int, char**)
         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;
 }

diff  --git a/libcxx/www/cxx1z_status.html b/libcxx/www/cxx1z_status.html
index 627f9a085cb2..8f3f88310a74 100644
--- a/libcxx/www/cxx1z_status.html
+++ b/libcxx/www/cxx1z_status.html
@@ -308,7 +308,7 @@ <h3>Library Working group Issues Status</h3>
 	<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>


        


More information about the libcxx-commits mailing list