diff --git a/include/vcpkg/base/expected.h b/include/vcpkg/base/expected.h index 9ead2d49ed..49ced29d1c 100644 --- a/include/vcpkg/base/expected.h +++ b/include/vcpkg/base/expected.h @@ -74,7 +74,8 @@ namespace vcpkg std::enable_if_t && !std::is_same_v, Error>, int> = 0> - ExpectedT(ConvToT&& t) : m_t(std::forward(t)), value_is_error(false) + ExpectedT(ConvToT&& t) noexcept(std::is_nothrow_constructible_v) + : m_t(std::forward(t)), value_is_error(false) { } @@ -83,18 +84,21 @@ namespace vcpkg !std::is_same_v, T>, int> = 0, int = 1> - ExpectedT(ConvToError&& e) : m_error(std::forward(e)), value_is_error(true) + ExpectedT(ConvToError&& e) noexcept(std::is_nothrow_constructible_v) + : m_error(std::forward(e)), value_is_error(true) { } // Constructors that explicitly specify left or right exist if the parameter is convertible to T or Error template, int> = 0> - ExpectedT(ConvToT&& t, ExpectedLeftTag) : m_t(std::forward(t)), value_is_error(false) + ExpectedT(ConvToT&& t, ExpectedLeftTag) noexcept(std::is_nothrow_constructible_v) + : m_t(std::forward(t)), value_is_error(false) { } template, int> = 0> - ExpectedT(ConvToError&& e, ExpectedRightTag) : m_error(std::forward(e)), value_is_error(true) + ExpectedT(ConvToError&& e, ExpectedRightTag) noexcept(std::is_nothrow_constructible_v) + : m_error(std::forward(e)), value_is_error(true) { }