From 3498c54ab108e046d956efba0f0627318d2193f4 Mon Sep 17 00:00:00 2001 From: Zonr Chang Date: Tue, 30 Aug 2016 13:37:29 -0700 Subject: [PATCH] Make type conversion from Expected<> to bool explicitly. Summary: Closes https://github.com/facebook/folly/pull/465 Reviewed By: yfeldblum Differential Revision: D3787146 Pulled By: Orvid fbshipit-source-id: 17433a256338bd107eec41e69af3eef58de3339b --- folly/test/ExpectedTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/folly/test/ExpectedTest.cpp b/folly/test/ExpectedTest.cpp index 771d81ed..52c09039 100644 --- a/folly/test/ExpectedTest.cpp +++ b/folly/test/ExpectedTest.cpp @@ -64,17 +64,17 @@ TEST(Expected, NoDefault) { static_assert( std::is_default_constructible>::value, ""); Expected x{in_place, 42, 42}; - EXPECT_TRUE(x); + EXPECT_TRUE(bool(x)); x.emplace(4, 5); EXPECT_TRUE(bool(x)); x = makeUnexpected(42); - EXPECT_FALSE(x); + EXPECT_FALSE(bool(x)); EXPECT_EQ(42, x.error()); } TEST(Expected, String) { Expected maybeString; - EXPECT_FALSE(maybeString); + EXPECT_FALSE(bool(maybeString)); EXPECT_EQ(0, maybeString.error()); maybeString = "hello"; EXPECT_TRUE(bool(maybeString)); -- 2.34.1