Skip to content

Commit e2c1dd5

Browse files
authored
Fix CI after #138708 (#140111)
Silence a warning in gtest casting a char8_t/char16_t to char32_t. Note that this cast, as well as the behavior of `PrintTo(char32_t)` is incorrect when printing a code unit that does not represent a code point. See google/googletest#4762
1 parent 58b9b86 commit e2c1dd5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

third-party/unittest/googletest/README.LLVM

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ Modified as follows:
1919
* Added StringRef support to include/gtest/internal/custom/gtest-printers.h.
2020
* Added LLVM printable value support to include/gtest/gtest-message.h and
2121
include/gtest/gtest-printers.h.
22+
* Modified `PrintTo(char16_t c, ::std::ostream* os)` and
23+
`PrintTo(char16_t c, ::std::ostream* os)` in include/gtest/gtest-printers.h.
24+
to work around https://github.com/google/googletest/issues/4762

third-party/unittest/googletest/include/gtest/gtest-printers.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,11 +510,15 @@ GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
510510

511511
GTEST_API_ void PrintTo(char32_t c, ::std::ostream* os);
512512
inline void PrintTo(char16_t c, ::std::ostream* os) {
513-
PrintTo(ImplicitCast_<char32_t>(c), os);
513+
// FIXME: the cast from char16_t to char32_t may be incorrect
514+
// for a lone surrogate
515+
PrintTo(static_cast<char32_t>(c), os);
514516
}
515517
#ifdef __cpp_lib_char8_t
516518
inline void PrintTo(char8_t c, ::std::ostream* os) {
517-
PrintTo(ImplicitCast_<char32_t>(c), os);
519+
// FIXME: the cast from char8_t to char32_t may be incorrect
520+
// for c > 0x7F
521+
PrintTo(static_cast<char32_t>(c), os);
518522
}
519523
#endif
520524

0 commit comments

Comments
 (0)