[llvm] r174458 - Revert "[Support][ErrorOr] Add support for convertable types."
Andrew Trick
atrick at apple.com
Tue Feb 5 14:50:20 PST 2013
Author: atrick
Date: Tue Feb 5 16:50:20 2013
New Revision: 174458
URL: http://llvm.org/viewvc/llvm-project?rev=174458&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Support/ErrorOr.h
llvm/trunk/unittests/Support/ErrorOrTest.cpp
Modified: llvm/trunk/include/llvm/Support/ErrorOr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ErrorOr.h?rev=174458&r1=174457&r2=174458&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ErrorOr.h (original)
+++ llvm/trunk/include/llvm/Support/ErrorOr.h Tue Feb 5 16:50:20 2013
@@ -162,7 +162,6 @@ public:
/// T cannot be a rvalue reference.
template<class T>
class ErrorOr {
- template <class OtherT> friend class ErrorOr;
static const bool isRef = is_reference<T>::value;
typedef ReferenceStorage<typename remove_reference<T>::type> wrap;
@@ -199,8 +198,7 @@ public:
new (get()) storage_type(moveIfMoveConstructible<storage_type>(Val));
}
- template <class OtherT>
- ErrorOr(ErrorOr<OtherT> &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 <class OtherT>
- ErrorOr(ErrorOr<OtherT> &&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!");
Modified: llvm/trunk/unittests/Support/ErrorOrTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ErrorOrTest.cpp?rev=174458&r1=174457&r2=174458&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/ErrorOrTest.cpp (original)
+++ llvm/trunk/unittests/Support/ErrorOrTest.cpp Tue Feb 5 16:50:20 2013
@@ -53,17 +53,6 @@ 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 {
More information about the llvm-commits
mailing list