From 0bad022a8e367d34ca5291372bd4d8793ab61f70 Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Wed, 17 Jan 2024 00:01:07 +0100 Subject: [PATCH] Rewrite aligning new to please MSVC MSVC was complaining about the previous form with: error C2956: usual deallocation function 'void operator delete[](void *,std::align_val_t) noexcept' would be chosen as placement deallocation function. --- examples/nbody_code_comp/nbody-SoA.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/nbody_code_comp/nbody-SoA.cpp b/examples/nbody_code_comp/nbody-SoA.cpp index ea5e385911..4689cbc7d5 100644 --- a/examples/nbody_code_comp/nbody-SoA.cpp +++ b/examples/nbody_code_comp/nbody-SoA.cpp @@ -58,7 +58,7 @@ struct AlignedAllocator { using value_type = T; auto allocate(std::size_t n) const -> T* { - return new(std::align_val_t{64}) T[n]; + return static_cast(::operator new[](n * sizeof(T), std::align_val_t{64})); } void deallocate(T* p, std::size_t) const {