Bug #85594 Custom allocators do not work with move-only types
Submitted: 23 Mar 2017 15:06 Modified: 24 Mar 2017 14:52
Reporter: Knut Anders Hatlen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.2 OS:Any
Assigned to: CPU Architecture:Any

[23 Mar 2017 15:06] Knut Anders Hatlen
Description:
Custom allocators (Malloc_allocator, Memroot_allocator, Stateless_allocator) don't work with types that have deleted copy constructors, such as std::unique_ptr.

How to repeat:
Create a vector of type std::vector<std::unique_ptr<int>, Memroot_allocator<std::unique_ptr<int>>>, and try to push_back() object into it. Won't compile.

Suggested fix:
Change the signature of the construct() function in the custom allocators so that it matches C++11, which enables use of move semantics.
[24 Mar 2017 14:52] Paul DuBois
Posted by developer:
 
Fixed in 8.0.2.

Code cleanup. No changelog entry needed.