diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 8406598..45b6c3f 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -501,7 +501,8 @@ public: \see GenericStringRef, operator=(T) */ GenericValue& operator=(StringRefType str) { - return (*this).operator=(str); + GenericValue s(str); + return *this = s; } //! Assignment with primitive types. @@ -519,9 +520,8 @@ public: template RAPIDJSON_DISABLEIF_RETURN(internal::IsPointer,GenericValue&) operator=(T value) { - this->~GenericValue(); - new (this) GenericValue(value); - return *this; + GenericValue v(value); + return *this = v; } //! Deep-copy assignment from Value