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 bug if TL_EXPECTED_EXCEPTIONS_ENABLED were disabled #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions include/tl/expected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,9 @@ class expected : private detail::expected_move_assign_base<T, E>,
if (has_value()) {
val() = std::forward<U>(v);
} else {
#ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
auto tmp = std::move(err());
#endif
err().~unexpected<E>();

#ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
Expand Down Expand Up @@ -1776,7 +1778,9 @@ class expected : private detail::expected_move_assign_base<T, E>,
val().~T();
::new (valptr()) T(std::forward<Args>(args)...);
} else {
#ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
auto tmp = std::move(err());
#endif
err().~unexpected<E>();

#ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
Expand Down