[libcxx-commits] [PATCH] D124555: [libcxx] basic_ios<wchar_t> cannot store fill character WCHAR_MAX

Hubert Tong via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 23 22:05:45 PDT 2022


hubert.reinterpretcast added inline comments.


================
Comment at: libcxx/include/ios:709
+        static const bool value = 
+            (WEOF >= (wint_t)WCHAR_MIN || WEOF <= (wint_t)WCHAR_MAX);
+    };
----------------
hubert.reinterpretcast wrote:
> If `wchar_t` is 16-bit unsigned, `wint_t` is 32-bit signed and `WEOF` is `-1`, then `WEOF` is less than `(wint_t)WCHAR_MAX` and `value` becomes `true` even though the new member is unneeded.
This should detect when `wint_t` is not wider than `wchar_t`:
```
WCHAR_MAX >= WINT_MAX || 1 + (wint_t)WCHAR_MAX == (wint_t)WCHAR_MIN
```
but using `sizeof` might be reasonable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124555/new/

https://reviews.llvm.org/D124555



More information about the libcxx-commits mailing list