summaryrefslogtreecommitdiff
path: root/include/llvm/Support/ErrorOr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Support/ErrorOr.h')
-rw-r--r--include/llvm/Support/ErrorOr.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/include/llvm/Support/ErrorOr.h b/include/llvm/Support/ErrorOr.h
index c22c3ca84f..828d77b852 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 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!");