Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix implicitly deleted operator= for variadic_results #1630

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

VaderDev
Copy link

@VaderDev VaderDev commented Sep 25, 2024

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
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant