Skip to content

Commit 4f6ff6d

Browse files
committed
FIX: Fix MSVC replaceable new
1 parent 80f2436 commit 4f6ff6d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/databento/detail/buffer.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ class Buffer : public IReadable, public IWritable {
5858
using UniqueBufPtr = std::unique_ptr<std::byte[], void (*)(std::byte*)>;
5959

6060
std::byte* AlignedNew(std::size_t capacity) {
61-
return new (kAlignment) std::byte[capacity];
61+
// Can't use `new` expression due to MSVC bug
62+
// See
63+
// https://developercommunity.visualstudio.com/t/using-c17-new-stdalign-val-tn-syntax-results-in-er/528320
64+
return static_cast<std::byte*>(operator new[](capacity, kAlignment));
6265
}
6366
static void AlignedDelete(std::byte* p) { operator delete[](p, kAlignment); }
6467

0 commit comments

Comments
 (0)