[libcxx] r273838 - Implement p0337r0. Delete operator= for polymorphic_allocator.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 26 17:55:25 PDT 2016
Author: ericwf
Date: Sun Jun 26 19:55:25 2016
New Revision: 273838
URL: http://llvm.org/viewvc/llvm-project?rev=273838&view=rev
Log:
Implement p0337r0. Delete operator= for polymorphic_allocator.
Modified:
libcxx/trunk/include/experimental/memory_resource
libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp
libcxx/trunk/test/support/uses_alloc_types.hpp
Modified: libcxx/trunk/include/experimental/memory_resource
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/memory_resource?rev=273838&r1=273837&r2=273838&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/memory_resource (original)
+++ libcxx/trunk/include/experimental/memory_resource Sun Jun 26 19:55:25 2016
@@ -176,7 +176,7 @@ public:
{}
polymorphic_allocator &
- operator=(polymorphic_allocator const &) = default;
+ operator=(polymorphic_allocator const &) = delete;
// 8.6.3, memory.polymorphic.allocator.mem
_LIBCPP_INLINE_VISIBILITY
Modified: libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp?rev=273838&r1=273837&r2=273838&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/assign.pass.cpp Sun Jun 26 19:55:25 2016
@@ -24,6 +24,6 @@ namespace ex = std::experimental::pmr;
int main()
{
typedef ex::polymorphic_allocator<void> T;
- static_assert(std::is_copy_assignable<T>::value, "");
- static_assert(std::is_move_assignable<T>::value, "");
+ static_assert(!std::is_copy_assignable<T>::value, "");
+ static_assert(!std::is_move_assignable<T>::value, "");
}
Modified: libcxx/trunk/test/support/uses_alloc_types.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/uses_alloc_types.hpp?rev=273838&r1=273837&r2=273838&view=diff
==============================================================================
--- libcxx/trunk/test/support/uses_alloc_types.hpp (original)
+++ libcxx/trunk/test/support/uses_alloc_types.hpp Sun Jun 26 19:55:25 2016
@@ -160,26 +160,26 @@ protected:
allocator(a)
{}
- template <class ...Args>
+ template <class ...Args, class ArgsIDL = detail::TakeNArgs<sizeof...(Args) - 1, Args&&...>>
UsesAllocatorTestBase(AllocLastTag, Args&&... args)
- : args_id(nullptr),
- constructor_called(UA_AllocLast)
+ : args_id(&makeTypeID<typename ArgsIDL::type>()),
+ constructor_called(UA_AllocLast),
+ allocator(getAllocatorFromPack(
+ typename ArgsIDL::type{},
+ std::forward<Args>(args)...))
{
- typedef typename detail::TakeNArgs<sizeof...(Args) - 1, Args&&...>::type
- ArgIDL;
- args_id = &makeTypeID<ArgIDL>();
- getAllocatorFromPack(ArgIDL{}, std::forward<Args>(args)...);
}
private:
template <class ...LArgs, class ...Args>
- void getAllocatorFromPack(ArgumentListID<LArgs...>, Args&&... args) {
- getAllocatorFromPackImp<LArgs const&...>(args...);
+ static CtorAlloc const& getAllocatorFromPack(ArgumentListID<LArgs...>, Args&&... args) {
+ return getAllocatorFromPackImp<LArgs const&...>(args...);
}
template <class ...LArgs>
- void getAllocatorFromPackImp(typename detail::Identity<LArgs>::type..., CtorAlloc const& alloc) {
- allocator = alloc;
+ static CtorAlloc const& getAllocatorFromPackImp(
+ typename detail::Identity<LArgs>::type..., CtorAlloc const& alloc) {
+ return alloc;
}
const TypeID* args_id;
More information about the cfe-commits
mailing list