diff options
Diffstat (limited to 'abseil-cpp/absl/base/exception_safety_testing_test.cc')
-rw-r--r-- | abseil-cpp/absl/base/exception_safety_testing_test.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/abseil-cpp/absl/base/exception_safety_testing_test.cc b/abseil-cpp/absl/base/exception_safety_testing_test.cc index a59be29..bf5aa7c 100644 --- a/abseil-cpp/absl/base/exception_safety_testing_test.cc +++ b/abseil-cpp/absl/base/exception_safety_testing_test.cc @@ -148,7 +148,7 @@ TEST(ThrowingValueTest, ThrowingBitwiseOps) { ThrowingValue<> bomb1, bomb2; TestOp([&bomb1]() { ~bomb1; }); - TestOp([&]() { bomb1& bomb2; }); + TestOp([&]() { bomb1 & bomb2; }); TestOp([&]() { bomb1 | bomb2; }); TestOp([&]() { bomb1 ^ bomb2; }); } @@ -332,13 +332,16 @@ TEST(ThrowingValueTest, NonThrowingPlacementDelete) { constexpr int kArrayLen = 2; // We intentionally create extra space to store the tag allocated by placement // new[]. - constexpr int kStorageLen = 4; + constexpr size_t kExtraSpaceLen = sizeof(size_t) * 2; alignas(ThrowingValue<>) unsigned char buf[sizeof(ThrowingValue<>)]; alignas(ThrowingValue<>) unsigned char - array_buf[sizeof(ThrowingValue<>[kStorageLen])]; + array_buf[kExtraSpaceLen + sizeof(ThrowingValue<>[kArrayLen])]; auto* placed = new (&buf) ThrowingValue<>(1); auto placed_array = new (&array_buf) ThrowingValue<>[kArrayLen]; + auto* placed_array_end = reinterpret_cast<unsigned char*>(placed_array) + + sizeof(ThrowingValue<>[kArrayLen]); + EXPECT_LE(placed_array_end, array_buf + sizeof(array_buf)); SetCountdown(); ExpectNoThrow([placed, &buf]() { @@ -701,7 +704,10 @@ struct BasicGuaranteeWithExtraContracts : public NonNegative { static constexpr int kExceptionSentinel = 9999; }; + +#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL constexpr int BasicGuaranteeWithExtraContracts::kExceptionSentinel; +#endif TEST(ExceptionCheckTest, BasicGuaranteeWithExtraContracts) { auto tester_with_val = |