diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-02-06 22:28:53 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-02-06 22:28:53 +0000 |
commit | 780e9004c85ee33a0bdd592aebe9b959f29c4fb2 (patch) | |
tree | 0143de9e24102f1c33114285ff47ed7de5e503c0 /unittests/Support | |
parent | f91b23c8cd9ba2bae0dd6c80457405fb9f492e87 (diff) |
[Support][ErrorOr] Add support for convertable types.
Thanks to Andrew, David, and Aaron for helping fix this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Support')
-rw-r--r-- | unittests/Support/ErrorOrTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unittests/Support/ErrorOrTest.cpp b/unittests/Support/ErrorOrTest.cpp index a8608860b8..aa0ddd5e79 100644 --- a/unittests/Support/ErrorOrTest.cpp +++ b/unittests/Support/ErrorOrTest.cpp @@ -53,6 +53,19 @@ TEST(ErrorOr, Types) { EXPECT_EQ(3, **t3()); #endif } + +struct B {}; +struct D : B {}; + +TEST(ErrorOr, Covariant) { + ErrorOr<B*> b(ErrorOr<D*>(0)); + b = ErrorOr<D*>(0); + +#if LLVM_HAS_CXX11_STDLIB + ErrorOr<std::unique_ptr<B> > b1(ErrorOr<std::unique_ptr<D> >(0)); + b1 = ErrorOr<std::unique_ptr<D> >(0); +#endif +} } // end anon namespace struct InvalidArgError { |