From 9b32bfb6516adb4baa31814e83ba3fd0aff423f1 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 3 Aug 2016 05:48:09 +0000 Subject: [PATCH] Fix an MSVC x64 compiler warning. Patch from STL@microsoft.com llvm-svn: 277573 --- .../allocator.traits.members/allocate.pass.cpp | 5 +++-- .../allocator.traits.members/allocate_hint.pass.cpp | 11 ++++++----- .../allocator.traits.members/deallocate.pass.cpp | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp index 490fdf5..ab8179c 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp @@ -17,6 +17,7 @@ // }; #include +#include #include template @@ -27,12 +28,12 @@ struct A value_type* allocate(std::size_t n) { assert(n == 10); - return (value_type*)0xDEADBEEF; + return reinterpret_cast(static_cast(0xDEADBEEF)); } }; int main() { A a; - assert(std::allocator_traits >::allocate(a, 10) == (int*)0xDEADBEEF); + assert(std::allocator_traits >::allocate(a, 10) == reinterpret_cast(static_cast(0xDEADBEEF))); } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp index 079db35..71f39d8 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp @@ -17,6 +17,7 @@ // }; #include +#include #include template @@ -27,7 +28,7 @@ struct A value_type* allocate(std::size_t n) { assert(n == 10); - return (value_type*)0xDEADBEEF; + return reinterpret_cast(static_cast(0xDEADBEEF)); } }; @@ -39,13 +40,13 @@ struct B value_type* allocate(std::size_t n) { assert(n == 12); - return (value_type*)0xEEADBEEF; + return reinterpret_cast(static_cast(0xEEADBEEF)); } value_type* allocate(std::size_t n, const void* p) { assert(n == 11); assert(p == 0); - return (value_type*)0xFEADBEEF; + return reinterpret_cast(static_cast(0xFEADBEEF)); } }; @@ -53,8 +54,8 @@ int main() { #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE A a; - assert(std::allocator_traits >::allocate(a, 10, nullptr) == (int*)0xDEADBEEF); + assert(std::allocator_traits >::allocate(a, 10, nullptr) == reinterpret_cast(static_cast(0xDEADBEEF))); #endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE B b; - assert(std::allocator_traits >::allocate(b, 11, nullptr) == (int*)0xFEADBEEF); + assert(std::allocator_traits >::allocate(b, 11, nullptr) == reinterpret_cast(static_cast(0xFEADBEEF))); } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp index b137dc6..8176d8b 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp @@ -17,6 +17,7 @@ // }; #include +#include #include int called = 0; @@ -28,7 +29,7 @@ struct A void deallocate(value_type* p, std::size_t n) { - assert(p == (value_type*)0xDEADBEEF); + assert(p == reinterpret_cast(static_cast(0xDEADBEEF))); assert(n == 10); ++called; } @@ -37,6 +38,6 @@ struct A int main() { A a; - std::allocator_traits >::deallocate(a, (int*)0xDEADBEEF, 10); + std::allocator_traits >::deallocate(a, reinterpret_cast(static_cast(0xDEADBEEF)), 10); assert(called == 1); } -- 2.7.4