Make type conversion from Expected<> to bool explicitly.
authorZonr Chang <zonr.net@gmail.com>
Tue, 30 Aug 2016 20:37:29 +0000 (13:37 -0700)
committerFacebook Github Bot 5 <facebook-github-bot-5-bot@fb.com>
Tue, 30 Aug 2016 20:38:34 +0000 (13:38 -0700)
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

index 771d81ed9cc43b2fc347ffc957aa01b6bbe60256..52c090394773a6aed891f84d59120ee8783ef02e 100644 (file)
@@ -64,17 +64,17 @@ TEST(Expected, NoDefault) {
   static_assert(
       std::is_default_constructible<Expected<NoDefault, int>>::value, "");
   Expected<NoDefault, int> 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<std::string, int> maybeString;
-  EXPECT_FALSE(maybeString);
+  EXPECT_FALSE(bool(maybeString));
   EXPECT_EQ(0, maybeString.error());
   maybeString = "hello";
   EXPECT_TRUE(bool(maybeString));