From 26a4d32e5a8dbe01ddafdac5cbefcc07ff9eb6f9 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Sat, 12 Oct 2024 20:01:11 +0800 Subject: [PATCH] Add another assertion --- proxy.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/proxy.h b/proxy.h index f25c531..f54b139 100644 --- a/proxy.h +++ b/proxy.h @@ -791,9 +791,12 @@ class proxy : public details::facade_traits::direct_accessor { private: template P& initialize(Args&&... args) { - std::construct_at(reinterpret_cast(ptr_), std::forward(args)...); + P& result = *std::construct_at( + reinterpret_cast(ptr_), std::forward(args)...); + if constexpr (requires { (bool)result; }) + { assert((bool)result); } meta_ = details::meta_ptr{std::in_place_type

}; - return *std::launder(reinterpret_cast(ptr_)); + return result; } [[___PRO_NO_UNIQUE_ADDRESS_ATTRIBUTE]]