diff --git a/include/internal/catch_stringref.cpp b/include/internal/catch_stringref.cpp index 5a15bbf6..49d9629f 100644 --- a/include/internal/catch_stringref.cpp +++ b/include/internal/catch_stringref.cpp @@ -17,10 +17,6 @@ namespace Catch { - auto StringRef::operator = ( StringRef other ) noexcept -> StringRef& { - swap( other ); - return *this; - } StringRef::operator std::string() const { return std::string( m_start, m_size ); } diff --git a/include/internal/catch_stringref.h b/include/internal/catch_stringref.h index fabd9ce8..2a9ad4c2 100644 --- a/include/internal/catch_stringref.h +++ b/include/internal/catch_stringref.h @@ -77,7 +77,14 @@ namespace Catch { delete[] m_data; } - auto operator = ( StringRef other ) noexcept -> StringRef&; + auto operator = ( StringRef const &other ) noexcept -> StringRef& { + delete[] m_data; + m_data = nullptr; + m_start = other.m_start; + m_size = other.m_size; + return *this; + } + operator std::string() const; void swap( StringRef& other ) noexcept;