diff --git a/dependencies/sol2/sol/sol.hpp b/dependencies/sol2/sol/sol.hpp index 6a257bf694..2e9f79eb55 100644 --- a/dependencies/sol2/sol/sol.hpp +++ b/dependencies/sol2/sol/sol.hpp @@ -6752,7 +6752,8 @@ namespace sol { static_assert(std::is_constructible::value, "T must be constructible with Args"); *this = nullopt; - this->construct(std::forward(args)...); + new (static_cast(this)) optional(std::in_place, std::forward(args)...); + return **this; } /// Swaps this optional with the other.