sol2
sol2 copied to clipboard
Fix implicitly deleted operator= for variadic_results
Hey,
This PR enables move and copy assignment of sol::variadic_results. Currently the move and copy assignment is implicitly deleted because sol::basic_variadic_results declares a move constructor with = default. Such declaration for copy and move constructor is not necessary, removing them would re-enable move and copy assignment.
Alternative implementation: with C++20 support move and copy assignment could be = default-ed too.
Alternative implementation: move and copy assignment could be could be user provided (with static_cast to base).
Example of usage of assignments which are implicitly deleted:
sol::variadic_results a;
sol::variadic_results b;
b = std::move(a);
GCC 14.2 output:
error: use of deleted function 'sol::variadic_results& sol::variadic_results::operator=(sol::variadic_results&&)'
note: 'sol::variadic_results& sol::variadic_results::operator=(sol::variadic_results&&)' is implicitly deleted because the default definition would be ill-formed:
...
error: use of deleted function 'constexpr sol::basic_variadic_results<>& sol::basic_variadic_results<>::operator=(const sol::basic_variadic_results<>&)'
note: 'constexpr sol::basic_variadic_results<>& sol::basic_variadic_results<>::operator=(const sol::basic_variadic_results<>&)' is implicitly declared as deleted because 'sol::basic_variadic_results<>' declares a move constructor or move assignment operator
...