summaryrefslogtreecommitdiffstats
path: root/unittests/Support
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2013-02-05 08:22:27 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2013-02-05 08:22:27 +0000
commita33e1fafac7fedb1b080ef07ddf9ad6ddff3a830 (patch)
tree2727b46a9768a084b243a39e79303d785b6b6745 /unittests/Support
parentea59f896a672c2e1ef9f02277bce60257aa60989 (diff)
downloadexternal_llvm-a33e1fafac7fedb1b080ef07ddf9ad6ddff3a830.zip
external_llvm-a33e1fafac7fedb1b080ef07ddf9ad6ddff3a830.tar.gz
external_llvm-a33e1fafac7fedb1b080ef07ddf9ad6ddff3a830.tar.bz2
[Support][ErrorOr] Add support for convertable types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Support')
-rw-r--r--unittests/Support/ErrorOrTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/Support/ErrorOrTest.cpp b/unittests/Support/ErrorOrTest.cpp
index a860886..6cef4fc 100644
--- a/unittests/Support/ErrorOrTest.cpp
+++ b/unittests/Support/ErrorOrTest.cpp
@@ -53,6 +53,17 @@ TEST(ErrorOr, Types) {
EXPECT_EQ(3, **t3());
#endif
}
+
+struct B {};
+struct D : B {};
+
+TEST(ErrorOr, Covariant) {
+ ErrorOr<B*> b(ErrorOr<D*>(0));
+
+#if LLVM_HAS_CXX11_STDLIB
+ ErrorOr<std::unique_ptr<B> > b1(ErrorOr<std::unique_ptr<D> >(0));
+#endif
+}
} // end anon namespace
struct InvalidArgError {