diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -703,7 +703,7 @@ } #endif - void assertIsChecked() { + void assertIsChecked() const { #if LLVM_ENABLE_ABI_BREAKING_CHECKS if (LLVM_UNLIKELY(Unchecked)) fatalUncheckedExpected(); diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp --- a/llvm/unittests/Support/ErrorTest.cpp +++ b/llvm/unittests/Support/ErrorTest.cpp @@ -556,7 +556,7 @@ TEST(Error, UncheckedExpectedInSuccessModeDestruction) { EXPECT_DEATH({ Expected A = 7; }, "Expected must be checked before access or destruction.") - << "Unchecekd Expected success value did not cause an abort()."; + << "Unchecked Expected success value did not cause an abort()."; } #endif @@ -565,9 +565,13 @@ // Test runs in debug mode only. #if LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, UncheckedExpectedInSuccessModeAccess) { - EXPECT_DEATH({ Expected A = 7; *A; }, - "Expected must be checked before access or destruction.") - << "Unchecekd Expected success value did not cause an abort()."; + EXPECT_DEATH( + { + const Expected A = 7; + *A; + }, + "Expected must be checked before access or destruction.") + << "Unchecked Expected success value did not cause an abort()."; } #endif @@ -576,9 +580,13 @@ // Test runs in debug mode only. #if LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, UncheckedExpectedInSuccessModeAssignment) { - EXPECT_DEATH({ Expected A = 7; A = 7; }, - "Expected must be checked before access or destruction.") - << "Unchecekd Expected success value did not cause an abort()."; + EXPECT_DEATH( + { + Expected A = 7; + A = 7; + }, + "Expected must be checked before access or destruction.") + << "Unchecked Expected success value did not cause an abort()."; } #endif