User-provided move constructor issue
sparik opened this issue · comments
Sparik Hayrapetyan commented
Hi.
Looks like if a type is not trivially move-constructible, then tl::expected<T, ...>
is not move-constructible at all. Is this behavior intended?
Here is an example tested with the current master branch and gcc 11.1
#include "expected.hpp"
struct user_provided_move {
user_provided_move() = default;
user_provided_move(user_provided_move&&) noexcept {}
};
struct defaulted_move {
defaulted_move() = default;
defaulted_move(defaulted_move&&) noexcept = default;
};
int main() {
tl::expected<user_provided_move, int> t1;
tl::expected<defaulted_move, int> t2;
tl::expected<user_provided_move, int> tm1(std::move(t1));
tl::expected<defaulted_move, int> tm2(std::move(t2)); // does not compile
}