From: Zonr Chang Date: Tue, 30 Aug 2016 20:37:29 +0000 (-0700) Subject: Make type conversion from Expected<> to bool explicitly. X-Git-Tag: v2016.09.05.00~14 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3498c54ab108e046d956efba0f0627318d2193f4;p=folly.git 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 --- 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));