From 4b0e04eb685b9ce8cb563177c5aaea9f7002fbf9 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 13 Aug 2021 17:03:55 +0200 Subject: [PATCH] :rotating_light: fix C4100 warnings --- test/src/unit-allocator.cpp | 5 +---- test/src/unit-udt.cpp | 11 ++++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/test/src/unit-allocator.cpp b/test/src/unit-allocator.cpp index c68e1886b..7b5a36090 100644 --- a/test/src/unit-allocator.cpp +++ b/test/src/unit-allocator.cpp @@ -100,9 +100,6 @@ struct my_allocator : std::allocator std::allocator::deallocate(p, n); } - // the code below warns about p in MSVC 2015 - this could be a bug - DOCTEST_MSVC_SUPPRESS_WARNING_PUSH - DOCTEST_MSVC_SUPPRESS_WARNING(4100) void destroy(T* p) { if (next_destroy_fails) @@ -111,9 +108,9 @@ struct my_allocator : std::allocator throw std::bad_alloc(); } + static_cast(p); // fix MSVC's C4100 warning p->~T(); } - DOCTEST_MSVC_SUPPRESS_WARNING_POP template struct rebind diff --git a/test/src/unit-udt.cpp b/test/src/unit-udt.cpp index 7871a7fba..12770ce64 100644 --- a/test/src/unit-udt.cpp +++ b/test/src/unit-udt.cpp @@ -809,10 +809,6 @@ TEST_CASE("an incomplete type does not trigger a compiler error in non-evaluated static_assert(!is_constructible_patched::value, ""); } -// the code below warns about t in MSVC 2015 - this could be a bug -DOCTEST_MSVC_SUPPRESS_WARNING_PUSH -DOCTEST_MSVC_SUPPRESS_WARNING(4100) - namespace { class Evil @@ -820,13 +816,14 @@ class Evil public: Evil() = default; template - Evil(T t) : m_i(sizeof(t)) {} + Evil(T t) : m_i(sizeof(t)) + { + static_cast(t); // fix MSVC's C4100 warning + } int m_i = 0; }; -DOCTEST_MSVC_SUPPRESS_WARNING_POP - void from_json(const json& /*unused*/, Evil& /*unused*/) {} } // namespace