Skip to content

Commit 072ebfe

Browse files
annihilatorqchriskohlhoff
authored andcommitted
Ensure 16-byte block alignment in co_composed's implementation on MSVC.
1 parent fa6662a commit 072ebfe

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

include/asio/co_composed.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,13 @@ class co_composed_promise
994994

995995
union block
996996
{
997+
#if defined(ASIO_MSVC) && !defined(__clang__)
998+
// Force 16-byte alignment as std::max_align_t is only 8-byte aligned on
999+
// MSVC, but the compiler may emit aligned SSE stores into the storage.
1000+
alignas(16) std::max_align_t max_align;
1001+
#else // defined(ASIO_MSVC) && !defined(__clang__)
9971002
std::max_align_t max_align;
1003+
#endif // defined(ASIO_MSVC) && !defined(__clang__)
9981004
alignas(allocator_type) char pad[alignof(allocator_type)];
9991005
};
10001006

0 commit comments

Comments
 (0)