That would just empty out the temporary string returned by the stringstream (if it was allowed at all since the string would be temporary). It wouldn't have any effect on the stream itself or the program.

A container class's clear() function (like what you used) is different than a stream class's clear() function.