Summary:
Consider `Expected<..., eUnion>(Expected&&)` ctor, where
`ExpectedUnion` move ctor would be called first, which is noop leaving
`which_` uninitialized; then `MoveConstructible` ctor is executed, calling
`assignValue()`, which performs action depending on uninitialized `which_`.
Reviewed By: yfeldblum
Differential Revision:
D4073199
fbshipit-source-id:
623660e7047afcebf9f72d83f91f84ff6078090f
union {
Value value_;
Error error_;
- char ch_;
+ char ch_{};
};
- Which which_;
+ Which which_ = Which::eEmpty;
- explicit constexpr ExpectedUnion(EmptyTag) noexcept
- : ch_{}, which_(Which::eEmpty) {}
+ explicit constexpr ExpectedUnion(EmptyTag) noexcept {}
template <class... Vs>
explicit constexpr ExpectedUnion(ValueTag, Vs&&... vs) noexcept(
noexcept(Value(static_cast<Vs&&>(vs)...)))