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

Summary:
In test/support/test_allocator.h, fix construct() to avoid moving immovable types.

This improves the allocator's conformance, and fixes compiler errors with MSVC's STL. The scenario is when the allocator is asked to construct an object of type X that's immovable (deleted copy/move ctors), but implicitly constructible from an argument type A. When perfectly forwarded, X can be (explicitly) constructed from A, and everything is fine. That's std::allocator's behavior, and the Standard's default when a user allocator's construct() doesn't exist. The previous implementation of construct() here mishandled this scenario. Passing A to this construct() would implicitly construct an X temporary, bound to (non-templated) T&&. Then construct() would attempt to move-construct X from that X temporary, but X is immovable, boom.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D21094

llvm-svn: 272747
GitOrigin-RevId: 4fae50267adb027583315842b169a8f6af7e06da
1 file changed