You can assign temporary objects. There is no rule to prevent this.
If you do not want a member function to be called temporarily (by r value, more generally), you can use ref-qualifier in the function declaration.
, std::string::operator= .
, ; , , , .