aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/ErrorTest.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2017-06-20 22:18:02 +0000
committerLang Hames <lhames@gmail.com>2017-06-20 22:18:02 +0000
commitcd22753689f6e91e0a2dc19b58a499d5c0b71790 (patch)
treefe772f535b7c7c03e9a23416365f8a83742140a9 /llvm/unittests/Support/ErrorTest.cpp
parent15ed29290643d2ee25e6b2368cda8c594abc6d7b (diff)
downloadllvm-cd22753689f6e91e0a2dc19b58a499d5c0b71790.zip
llvm-cd22753689f6e91e0a2dc19b58a499d5c0b71790.tar.gz
llvm-cd22753689f6e91e0a2dc19b58a499d5c0b71790.tar.bz2
Add a cantFail overload for Expected-reference (Expected<T&>) types.
llvm-svn: 305863
Diffstat (limited to 'llvm/unittests/Support/ErrorTest.cpp')
-rw-r--r--llvm/unittests/Support/ErrorTest.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
index 382346c..299fc50 100644
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -475,6 +475,10 @@ TEST(Error, CantFailSuccess) {
int X = cantFail(Expected<int>(42));
EXPECT_EQ(X, 42) << "Expected value modified by cantFail";
+
+ int Dummy = 42;
+ int &Y = cantFail(Expected<int&>(Dummy));
+ EXPECT_EQ(&Dummy, &Y) << "Reference mangled by cantFail";
}
// Test that cantFail results in a crash if you pass it a failure value.