From: Andrew Trick Date: Tue, 5 Feb 2013 22:50:20 +0000 (+0000) Subject: Revert "[Support][ErrorOr] Add support for convertable types." X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2a78bb961ad99cfc9ae4e8a05a9a5a6bf84e41f3;p=oota-llvm.git Revert "[Support][ErrorOr] Add support for convertable types." This reverts commit a33e1fafac7fedb1b080ef07ddf9ad6ddff3a830. This unit test crashes on Darwon. It needs to be temporarily reverted to unblock the test infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174458 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/ErrorOr.h b/include/llvm/Support/ErrorOr.h index c22c3ca84ff..828d77b852e 100644 --- a/include/llvm/Support/ErrorOr.h +++ b/include/llvm/Support/ErrorOr.h @@ -162,7 +162,6 @@ public: /// T cannot be a rvalue reference. template class ErrorOr { - template friend class ErrorOr; static const bool isRef = is_reference::value; typedef ReferenceStorage::type> wrap; @@ -199,8 +198,7 @@ public: new (get()) storage_type(moveIfMoveConstructible(Val)); } - template - ErrorOr(ErrorOr &Other) : IsValid(false) { + ErrorOr(const ErrorOr &Other) : IsValid(false) { // Construct an invalid ErrorOr if other is invalid. if (!Other.IsValid) return; @@ -228,8 +226,7 @@ public: } #if LLVM_HAS_RVALUE_REFERENCES - template - ErrorOr(ErrorOr &&Other) : IsValid(false) { + ErrorOr(ErrorOr &&Other) : IsValid(false) { // Construct an invalid ErrorOr if other is invalid. if (!Other.IsValid) return; @@ -311,6 +308,7 @@ private: return &Val->get(); } +protected: storage_type *get() { assert(IsValid && "Can't do anything on a default constructed ErrorOr!"); assert(!HasError && "Cannot get value when an error exists!"); diff --git a/unittests/Support/ErrorOrTest.cpp b/unittests/Support/ErrorOrTest.cpp index 6cef4fc212f..a8608860b84 100644 --- a/unittests/Support/ErrorOrTest.cpp +++ b/unittests/Support/ErrorOrTest.cpp @@ -53,17 +53,6 @@ TEST(ErrorOr, Types) { EXPECT_EQ(3, **t3()); #endif } - -struct B {}; -struct D : B {}; - -TEST(ErrorOr, Covariant) { - ErrorOr b(ErrorOr(0)); - -#if LLVM_HAS_CXX11_STDLIB - ErrorOr > b1(ErrorOr >(0)); -#endif -} } // end anon namespace struct InvalidArgError {