about summary refs log tree commit diff
path: root/absl/base/exception_safety_testing_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-03-15T20·48-0700
committerAlex Strelnikov <strel@google.com>2018-03-16T14·00-0400
commiteed36bfba04dbe8a08ec72e631c3b337e4f2db11 (patch)
treeb67e166f799d78acf59dbf54ced6acdde7687bc7 /absl/base/exception_safety_testing_test.cc
parent2661ed4998e8c5e9fa0a7f58b2d32eeab6544a70 (diff)
Changes imported from Abseil "staging" branch:
  - 95e20a66bfa6104937ec92722b04a9c0ca0443dc Make ThrowingBool convertible to bool. by Xiaoyi Zhang <zhangxy@google.com>

GitOrigin-RevId: 95e20a66bfa6104937ec92722b04a9c0ca0443dc
Change-Id: I7a1dcb53b0764b24482ee1886276b267c8cb83c2
Diffstat (limited to 'absl/base/exception_safety_testing_test.cc')
-rw-r--r--absl/base/exception_safety_testing_test.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/absl/base/exception_safety_testing_test.cc b/absl/base/exception_safety_testing_test.cc
index 5477b40a5bed..f8baf20c9360 100644
--- a/absl/base/exception_safety_testing_test.cc
+++ b/absl/base/exception_safety_testing_test.cc
@@ -18,6 +18,7 @@
 #include <exception>
 #include <iostream>
 #include <list>
+#include <type_traits>
 #include <vector>
 
 #include "gtest/gtest-spi.h"
@@ -683,6 +684,18 @@ TEST(AllocInspectorTest, ConstructedTwice) {
         new (&storage) Tracked;
       },
       "re-constructed");
+  reinterpret_cast<Tracked*>(&storage)->~Tracked();
 }
+
+TEST(ThrowingValueTraitsTest, RelationalOperators) {
+  ThrowingValue<> a, b;
+  EXPECT_TRUE((std::is_convertible<decltype(a == b), bool>::value));
+  EXPECT_TRUE((std::is_convertible<decltype(a != b), bool>::value));
+  EXPECT_TRUE((std::is_convertible<decltype(a < b), bool>::value));
+  EXPECT_TRUE((std::is_convertible<decltype(a <= b), bool>::value));
+  EXPECT_TRUE((std::is_convertible<decltype(a > b), bool>::value));
+  EXPECT_TRUE((std::is_convertible<decltype(a >= b), bool>::value));
+}
+
 }  // namespace
 }  // namespace absl