From 4ce31695f1f05095549350ad966b16994ce828d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Art=C3=B6m=20Bakri=20Al-Sarmini?= <3sz3tt+git@gmail.com> Date: Wed, 8 Apr 2020 00:26:43 +0300 Subject: [PATCH] Fixed formatting, trying to fix msvc build error in appveyor --- test/src/unit-allocator.cpp | 41 ++++++++++++++----------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/test/src/unit-allocator.cpp b/test/src/unit-allocator.cpp index f817897c5..4cac5872f 100644 --- a/test/src/unit-allocator.cpp +++ b/test/src/unit-allocator.cpp @@ -238,28 +238,17 @@ TEST_CASE("controlled bad_alloc") namespace { template -struct allocator_no_forward +struct allocator_no_forward : std::allocator { - typedef T value_type; template - struct rebind - { + struct rebind { typedef allocator_no_forward other; }; - T* allocate(size_t sz) + template + void construct(T* p, const Args&... args) { - return static_cast(malloc(sz * sizeof(T))); - } - - void deallocate(T* p, size_t) - { - free(p); - } - - void construct(T* p, const T& arg) - { - ::new (static_cast(p)) T(arg); + ::new (static_cast(p)) T(args...); } }; } @@ -269,16 +258,16 @@ TEST_CASE("bad my_allocator::construct") SECTION("my_allocator::construct doesn't forward") { using bad_alloc_json = nlohmann::basic_json; + std::vector, + std::string, + bool, + std::int64_t, + std::uint64_t, + double, + allocator_no_forward>; - bad_alloc_json json; - json["test"] = bad_alloc_json::array_t(); - json["test"].push_back("should not leak"); + bad_alloc_json json; + json["test"] = bad_alloc_json::array_t(); + json["test"].push_back("should not leak"); } }