diff --git a/rpcs3/util/fixed_typemap.hpp b/rpcs3/util/fixed_typemap.hpp index b8844e22a6..4df9c57891 100644 --- a/rpcs3/util/fixed_typemap.hpp +++ b/rpcs3/util/fixed_typemap.hpp @@ -396,15 +396,17 @@ namespace stx } // Explicitly initialize object of type T possibly with dynamic type As and arguments - template + template requires (std::is_constructible_v, Args&&...>) As* init(Args&&... args) noexcept { - if (std::exchange(m_init[stx::typeindex, std::decay_t>()], true)) + if (m_init[stx::typeindex, std::decay_t>()]) { // Already exists, recreation is not supported (may be added later) return nullptr; } + m_init[stx::typeindex, std::decay_t>()] = true; + As* obj = nullptr; g_tls_serialize_name = get_name(); @@ -471,7 +473,7 @@ namespace stx { if (is_init()) { - [[likely]] return &get(); + [[likely]] return std::addressof(get()); } [[unlikely]] return nullptr;