diff options
-rw-r--r-- | include/llvm/ADT/OwningPtr.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/llvm/ADT/OwningPtr.h b/include/llvm/ADT/OwningPtr.h index 6d9c305..e82ebc7 100644 --- a/include/llvm/ADT/OwningPtr.h +++ b/include/llvm/ADT/OwningPtr.h @@ -25,12 +25,15 @@ namespace llvm { /// pointee object can be taken away from OwningPtr by using the take method. template<class T> class OwningPtr { - OwningPtr(OwningPtr const &); // DO NOT IMPLEMENT - OwningPtr &operator=(OwningPtr const &); // DO NOT IMPLEMENT + OwningPtr &operator=(const OwningPtr &); // DO NOT IMPLEMENT T *Ptr; public: explicit OwningPtr(T *P = 0) : Ptr(P) {} + OwningPtr(const OwningPtr &RHS) : Ptr(0) { + assert(RHS.Ptr == 0 && "Only null OwningPtr's are copyable!"); + } + ~OwningPtr() { delete Ptr; } |