-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Undefined behaviour when copying dynamic_format_arg_store #2653
Comments
The easiest solution is to mark the copy ctor as deleted. A PR would be welcome. |
#2432 added the copy constructor and seemed to have a use case for it. Are you saying this is no longer required and the copy ctor should now be removed? |
I think we should disable the copy ctor because it's currently broken. If someone has a use case they can contribute a fix later. |
Disable the broken copy ctor in be51ee1. I don't think there is much reason to copy |
Thanks for reporting. |
@vitaut The actual arguments cannot be copied from an I did not copy the |
@vitaut Any suggested solution? |
I see you've submitted a PR (#2832) so let's discuss there. |
The copy constructor of dynamic_format_arg_store completely ignores the dynamic_args_ private member variable. This can unexpectedly cause undefined behaviour when a dynamic_format_arg_store instance is copied, since anything stored in dynamic_args_ will not get copied over. See the following for an example:
https://godbolt.org/z/8n7rnM55E
I can think of a couple of ways of fixing this problem, and I'd be happy to provide a PR with a fix, but I first wanted to get input from library maintainers on what would be the best solution.
The text was updated successfully, but these errors were encountered: