[libcxx-commits] [libcxx] [libc++] Ensure that we restore invariants in basic_filebuf::overflow (PR #147389)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 11 08:42:27 PDT 2025
================
@@ -841,8 +849,9 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
if (__always_noconv_) {
size_t __n = static_cast<size_t>(this->pptr() - this->pbase());
- if (std::fwrite(this->pbase(), sizeof(char_type), __n, __file_) != __n)
- return traits_type::eof();
+ if (std::fwrite(this->pbase(), sizeof(char_type), __n, __file_) != __n) {
----------------
ldionne wrote:
The facet for `wchar_t` returns `always_noconv() == false`, so we're also testing below. We could try to hit every branch in the `if` but I think there is diminishing returns.
https://github.com/llvm/llvm-project/pull/147389
More information about the libcxx-commits
mailing list