Skip to content

add noexcept on assignment operators, and a test check those #91

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lightmare
Copy link
Contributor

You can check how the test ran on master here: https://travis-ci.org/lightmare/variant/builds/106630852

With this patch Travis/AppVeyor will still fail, that's intended.

Except for Xcode6 having some issue with is_nothrow_move_constructible, all other builds on travis will have only 2 failed is_nothrow_destructible checks. Those will go away once ~variant() is declared noexcept (unconditionally), but I didn't wan't to touch that line so that it doesn't conflict with reverting previous commits or any other fix to the destructor issue.

AppVeyor has more than 2 failing is_nothrow_destructible, that might mean it's indeed broken on MSVC and so the checks will need to be skipped/removed.

Note: I removed private functions copy_assign and move_assign -- the names were misleading, they did destroy&construct, not assign -- and copied their bodies to respective operators.

- they are no better than what the compiler will do to perform such
  assigments without explicit operators - construct a temporary variant
  using conversion constructor, and move-assign from the temporary
@tomilov
Copy link

tomilov commented Feb 3, 2016

Note, that in C++11 and later destructors marked by noexcept implicitly (if destructors of all non static members and base classes are noexcept in its turn). There no need to mark them intentionally.

@lightmare
Copy link
Contributor Author

Shall I rebase this on master? I sooo much hate merge conflicts 🍝

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.

2 participants