-
Notifications
You must be signed in to change notification settings - Fork 100
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
Noexcept on operator=() is wrong #88
Comments
Yes, should be noexcept(noexcept(variant<Types...>(std::forward<T>(rhs))) &&
std::is_move_constructible<std::tuple<Types...>>::value) The first part covers Edit: assignable->constructible, as helper::move calls constructor. It'd probably be best to dispatch on rvalue-ness of While you're looking at it... the copy-assignment below makes an unnecessary second copy; and it is actually redundant -- the universal covers lvalue references as well. |
I don't feel comfortable having such complex code (especially in areas with compiler problems like #86) without any tests. And it is really easy to get the implementation of the function and the |
In that case, just remove both conversion-assignment operators, they're not needed -- actually the compiler will generate exactly the code in the first, and better than the second: v = x; // conversion constructor from decltype(x) must be available
// the compiler will do
v = V(x); // i.e. construct a temporary variant and move-assign =(V&&) |
- 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
I think the
noexcept
onoperator()
here is wrong. There are several operations involved which all might fail.The text was updated successfully, but these errors were encountered: