From f3e9d066df50a6e77e8c15ea97b195a4b069f254 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 24 May 2023 11:56:56 -0700 Subject: Be a bit more safe with type mangling --- core/async_event.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/async_event.h') diff --git a/core/async_event.h b/core/async_event.h index 9e2d1193..c049fa02 100644 --- a/core/async_event.h +++ b/core/async_event.h @@ -54,7 +54,11 @@ using AsyncEvent = std::variant; template -auto &InitAsyncEvent(AsyncEvent *evt, Args&& ...args) -{ return std::get(*al::construct_at(evt, std::in_place_type, std::forward(args)...)); } +auto &InitAsyncEvent(std::byte *evtbuf, Args&& ...args) +{ + auto *evt = al::construct_at(reinterpret_cast(evtbuf), std::in_place_type, + std::forward(args)...); + return std::get(*evt); +} #endif -- cgit v1.2.3