This behavior is expected as the assignment operator for GenericValue uses move semantics.
Here is the assignment operator for GenericValue in rapidjson:
//! Assignment with move semantics.
/*! \param rhs Source of the assignment. It will become a null value after assignment.
*/
GenericValue& operator=(GenericValue& rhs) {
RAPIDJSON_ASSERT(this != &rhs);
this->~GenericValue();
memcpy(this, &rhs, sizeof(GenericValue));
rhs.flags_ = kNullFlag;
return *this;
}
When memberObject is assigned to _value, the assignment operator kicks in changing the flags_ member which is the value returned by the GetType() method of the rvalue object.
For more details on move semantics, please see What are move semantics?