boostorg / system

Boost.org system module
http://boost.org/libs/system
36 stars 85 forks source link

Fix error_code's operator<< for arbitrary basic_ostream specializations #76

Closed MarcelRaad closed 2 years ago

MarcelRaad commented 2 years ago

This fixes a regression from commit https://github.com/boostorg/system/commit/a9b64a888a24400cc2af9910a6ff88c3c4fd3210. 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.

pdimov commented 2 years ago

Do you have a code example that demonstrates the failure?

pdimov commented 2 years ago

This one probably. https://godbolt.org/z/soPKj3zWc

MarcelRaad commented 2 years ago

Yes, that's a good one. And I'm using MSVC 19.29.

MarcelRaad commented 2 years ago

Thanks for merging and adding the regression test!