Index: llvm/trunk/include/llvm/ADT/SmallVector.h =================================================================== --- llvm/trunk/include/llvm/ADT/SmallVector.h +++ llvm/trunk/include/llvm/ADT/SmallVector.h @@ -339,9 +339,7 @@ SmallVectorImpl(const SmallVectorImpl &) = delete; ~SmallVectorImpl() { - // Destroy the constructed elements in the vector. - this->destroy_range(this->begin(), this->end()); - + // Subclass has already destructed this vector's elements. // If this wasn't grown from the inline copy, deallocate the old space. if (!this->isSmall()) free(this->begin()); @@ -868,6 +866,11 @@ public: SmallVector() : SmallVectorImpl(N) {} + ~SmallVector() { + // Destroy the constructed elements in the vector. + this->destroy_range(this->begin(), this->end()); + } + explicit SmallVector(size_t Size, const T &Value = T()) : SmallVectorImpl(N) { this->assign(Size, Value);