[PATCH] D21094: [libcxx] [test] In test/support/test_allocator.h, fix construct() to avoid moving immovable types.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 23:00:03 PDT 2016


EricWF added inline comments.

================
Comment at: test/support/test_allocator.h:83
@@ -82,2 +82,3 @@
         {return UINT_MAX / sizeof(T);}
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     void construct(pointer p, const T& val)
----------------
`#if TEST_STD_VER < 11`

================
Comment at: test/support/test_allocator.h:88
@@ -88,1 +87,3 @@
+    template <class U> void construct(pointer p, U&& val)
+        {::new(p) T(std::forward<U>(val));}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
----------------
While your here this should have be `::new ((void*)p)`.

I learned that from you :-P

================
Comment at: test/support/test_allocator.h:144
@@ -142,2 +143,3 @@
         {return UINT_MAX / sizeof(T);}
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     void construct(pointer p, const T& val)
----------------
`#if TEST_STD_VER < 11` please.

================
Comment at: test/support/test_allocator.h:149
@@ -148,1 +148,3 @@
+    template <class U> void construct(pointer p, U&& val)
+        {::new(p) T(std::forward<U>(val));}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
----------------
While your here this should have be `::new ((void*)p)`.


http://reviews.llvm.org/D21094





More information about the cfe-commits mailing list