Don't decode a UTF-8 character that is out of range for a 16 bit
wchar_t.
Details
- Reviewers
ldionne - Group Reviewers
Restricted Project - Commits
- rG9a9a372d38f4: [libcxx] [test] Fix testcases that fail on systems with 16 bit wchar_t
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
IMHO it might be better to add your new test, but keep the existing test under an if (sizeof(wchar_t) >= 4) or if (WCHAR_MAX > 100003-or-whatever), something like that. It feels important to test that on platforms with 32-bit wchar_t, we can actually use all 32 bits and aren't silently truncating to 16 bits somewhere internally.
(That said, what the heck, why is this test discarding the value of .from_bytes instead of asserting on it.)
It's possible both of my comments are sufficiently addressed by test coverage elsewhere in the test suite, in which case, looks great, ship it!
I presume the main intent of this test is to test some other aspect (move constructor), not test the conversion itself, and therefore it doesn't really functionally test the conversion.
It's possible both of my comments are sufficiently addressed by test coverage elsewhere in the test suite, in which case, looks great, ship it!
Not sure offhand, but this as this test only is for the move constructor, I would guess so.
I think the test that Arthur is talking about is handled in libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp. Therefore, this LGTM.