Skip to content
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

Fix etl::expected assignment from etl::unexpected #733

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions include/etl/expected.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,25 +450,25 @@ namespace etl
#endif

//*******************************************
/// Copy assign from error
/// Copy assign from unexpected
//*******************************************
expected& operator =(const unexpected_type& error)
expected& operator =(const unexpected_type& ue)
{
ETL_STATIC_ASSERT(etl::is_copy_constructible<TError>::value, "Error not copy assignable");

storage.template emplace<Error_Type>(error);
storage.template emplace<Error_Type>(ue.error());
return *this;
}

#if ETL_USING_CPP11
//*******************************************
/// Move assign from error
/// Move assign from unexpected
//*******************************************
expected& operator =(unexpected_type&& error)
expected& operator =(unexpected_type&& ue)
{
ETL_STATIC_ASSERT(etl::is_move_constructible<TError>::value, "Error not move assignable");

storage.template emplace<Error_Type>(etl::move(error));
storage.template emplace<Error_Type>(etl::move(ue.error()));
return *this;
}
#endif
Expand Down Expand Up @@ -830,25 +830,25 @@ namespace etl
#endif

//*******************************************
/// Copy assign from error
/// Copy assign from unexpected
//*******************************************
expected& operator =(const unexpected_type& error)
expected& operator =(const unexpected_type& ue)
{
ETL_STATIC_ASSERT(etl::is_copy_constructible<TError>::value, "Error not copy assignable");

storage.template emplace<Error_Type>(error);
storage.template emplace<Error_Type>(ue.error());
return *this;
}

#if ETL_USING_CPP11
//*******************************************
/// Move assign from error
/// Move assign from unexpected
//*******************************************
expected& operator =(unexpected_type&& error)
expected& operator =(unexpected_type&& ue)
{
ETL_STATIC_ASSERT(etl::is_move_constructible<TError>::value, "Error not move assignable");

storage.template emplace<Error_Type>(etl::move(error));
storage.template emplace<Error_Type>(etl::move(ue.error()));
return *this;
}
#endif
Expand Down
Loading