STL_MSFT updated this revision to Diff 60736. STL_MSFT added a comment. Inspect TEST_STD_VER and cast to void* as requested. I used a static_cast to avoid triggering any old-style cast warnings.
(I also just noticed that I deleted an empty line, but was too lazy to regenerate the diff. Oops.) http://reviews.llvm.org/D21094 Files: test/support/test_allocator.h Index: test/support/test_allocator.h =================================================================== --- test/support/test_allocator.h +++ test/support/test_allocator.h @@ -80,14 +80,14 @@ {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);} size_type max_size() const throw() {return UINT_MAX / sizeof(T);} +#if TEST_STD_VER < 11 void construct(pointer p, const T& val) - {::new(p) T(val);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - void construct(pointer p, T&& val) - {::new(p) T(std::move(val));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + {::new(static_cast<void*>(p)) T(val);} +#else + template <class U> void construct(pointer p, U&& val) + {::new(static_cast<void*>(p)) T(std::forward<U>(val));} +#endif void destroy(pointer p) {p->~T();} - friend bool operator==(const test_allocator& x, const test_allocator& y) {return x.data_ == y.data_;} friend bool operator!=(const test_allocator& x, const test_allocator& y) @@ -140,12 +140,13 @@ {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); } size_type max_size() const throw() {return UINT_MAX / sizeof(T);} +#if TEST_STD_VER < 11 void construct(pointer p, const T& val) - {::new(p) T(val);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - void construct(pointer p, T&& val) - {::new(p) T(std::move(val));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + {::new(static_cast<void*>(p)) T(val);} +#else + template <class U> void construct(pointer p, U&& val) + {::new(static_cast<void*>(p)) T(std::forward<U>(val));} +#endif void destroy(pointer p) {p->~T();} friend bool operator==(const non_default_test_allocator& x, const non_default_test_allocator& y)
Index: test/support/test_allocator.h =================================================================== --- test/support/test_allocator.h +++ test/support/test_allocator.h @@ -80,14 +80,14 @@ {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);} size_type max_size() const throw() {return UINT_MAX / sizeof(T);} +#if TEST_STD_VER < 11 void construct(pointer p, const T& val) - {::new(p) T(val);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - void construct(pointer p, T&& val) - {::new(p) T(std::move(val));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + {::new(static_cast<void*>(p)) T(val);} +#else + template <class U> void construct(pointer p, U&& val) + {::new(static_cast<void*>(p)) T(std::forward<U>(val));} +#endif void destroy(pointer p) {p->~T();} - friend bool operator==(const test_allocator& x, const test_allocator& y) {return x.data_ == y.data_;} friend bool operator!=(const test_allocator& x, const test_allocator& y) @@ -140,12 +140,13 @@ {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); } size_type max_size() const throw() {return UINT_MAX / sizeof(T);} +#if TEST_STD_VER < 11 void construct(pointer p, const T& val) - {::new(p) T(val);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - void construct(pointer p, T&& val) - {::new(p) T(std::move(val));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + {::new(static_cast<void*>(p)) T(val);} +#else + template <class U> void construct(pointer p, U&& val) + {::new(static_cast<void*>(p)) T(std::forward<U>(val));} +#endif void destroy(pointer p) {p->~T();} friend bool operator==(const non_default_test_allocator& x, const non_default_test_allocator& y)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits