Fix error_code's operator<< for arbitrary basic_ostream specializations

This fixes a regression from commit
a9b64a888a.
Calling `operator<<` with `std::string` only works for `std::ostream`.
Use `c_str()` to restore the previous behavior of using `const char*`,
which works for any `basic_ostream` specialization.
This commit is contained in:
Marcel Raad
2021-12-21 13:17:26 +01:00
parent 204e65f725
commit 86b031cab9

View File

@@ -604,7 +604,7 @@ public:
inline friend std::basic_ostream<Ch, Tr>&
operator<< (std::basic_ostream<Ch, Tr>& os, error_code const & ec)
{
return os << ec.to_string();
return os << ec.to_string().c_str();
}
std::string what() const