diff --git a/folly/Expected.h b/folly/Expected.h index 678966ffd13..feb1f74ad53 100644 --- a/folly/Expected.h +++ b/folly/Expected.h @@ -977,27 +977,6 @@ class Expected final : expected_detail::ExpectedStorage { this->assign(std::move(that)); } - // Implicit then-chaining conversion: if `Expected` can be - // constructed from `V`, then we can directly convert `Expected` to - // `Expected`. - // - // Specifically, this allows a user-defined conversions of `V` to - // `Expected` to work as desired with range-based iteration - // over containers of `Expected`. - template < - class V, - class E FOLLY_REQUIRES_TRAILING( - !std::is_same, Expected>::value && - !std::is_constructible::value && - std::is_constructible, V&&>::value && - std::is_constructible::value)> - /* implicit */ Expected(Expected that) - : Base{expected_detail::EmptyTag{}} { - this->assign(std::move(that).then([](V&& v) -> Expected { - return Expected{v}; - })); - } - FOLLY_REQUIRES(std::is_copy_constructible::value) constexpr /* implicit */ Expected(const Value& val) noexcept( noexcept(Value(val))) diff --git a/folly/test/ExpectedTest.cpp b/folly/test/ExpectedTest.cpp index 001a46b0788..52255a6fcd2 100644 --- a/folly/test/ExpectedTest.cpp +++ b/folly/test/ExpectedTest.cpp @@ -970,19 +970,6 @@ TEST(Expected, TestUnique) { })); } -struct ConvertibleNum { - /*implicit*/ operator Expected() const { return num_; } - int num_; -}; - -TEST(Expected, TestChainedConversion) { - auto vs = - std::vector>{ConvertibleNum{.num_ = 137}}; - for (Expected v : vs) { - ASSERT_EQ(137, *v); - } -} - struct ConvertibleError { struct E1 {}; struct E2 {};