mapbox / variant

C++11/C++14 Variant
BSD 3-Clause "New" or "Revised" License
371 stars 100 forks source link

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

Open lightmare opened 8 years ago

lightmare commented 8 years ago

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.

tomilov commented 8 years ago

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 commented 8 years ago

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