[llvm] r337625 - [ADT] Only run death tests in !NDEBUG
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 20 15:15:09 PDT 2018
Author: d0k
Date: Fri Jul 20 15:15:09 2018
New Revision: 337625
URL: http://llvm.org/viewvc/llvm-project?rev=337625&view=rev
Log:
[ADT] Only run death tests in !NDEBUG
These invoke undefined behavior.
Modified:
llvm/trunk/unittests/ADT/AnyTest.cpp
Modified: llvm/trunk/unittests/ADT/AnyTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/AnyTest.cpp?rev=337625&r1=337624&r2=337625&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/AnyTest.cpp (original)
+++ llvm/trunk/unittests/ADT/AnyTest.cpp Fri Jul 20 15:15:09 2018
@@ -160,14 +160,16 @@ TEST(AnyTest, BadAnyCast) {
llvm::Any C{"hello"};
llvm::Any D{'x'};
- EXPECT_DEBUG_DEATH(llvm::any_cast<int>(A), "");
+#if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST
+ EXPECT_DEATH(llvm::any_cast<int>(A), "");
- EXPECT_DEBUG_DEATH(llvm::any_cast<float>(B), "");
- EXPECT_DEBUG_DEATH(llvm::any_cast<int *>(B), "");
+ EXPECT_DEATH(llvm::any_cast<float>(B), "");
+ EXPECT_DEATH(llvm::any_cast<int *>(B), "");
- EXPECT_DEBUG_DEATH(llvm::any_cast<std::string>(C), "");
+ EXPECT_DEATH(llvm::any_cast<std::string>(C), "");
- EXPECT_DEBUG_DEATH(llvm::any_cast<unsigned char>(D), "");
+ EXPECT_DEATH(llvm::any_cast<unsigned char>(D), "");
+#endif
}
} // anonymous namespace
More information about the llvm-commits
mailing list