@@ -505,24 +505,21 @@ inline void PrintTo(unsigned char* s, ::std::ostream* os) {
505505  PrintTo (ImplicitCast_<const  void *>(s), os);
506506}
507507#ifdef  __cpp_char8_t
508- inline  void  PrintTo (const  char8_t * s, ::std::ostream* os) {
509-   PrintTo (ImplicitCast_<const  void *>(s), os);
510- }
508+ //  Overloads for u8 strings.
509+ void  PrintTo (const  char8_t * s, ::std::ostream* os);
511510inline  void  PrintTo (char8_t * s, ::std::ostream* os) {
512-   PrintTo (ImplicitCast_<const  void *>(s), os);
511+   PrintTo (ImplicitCast_<const  char8_t *>(s), os);
513512}
514513#endif 
515- inline  void  PrintTo (const  char16_t * s, ::std::ostream* os) {
516-   PrintTo (ImplicitCast_<const  void *>(s), os);
517- }
514+ //  Overloads for u16 strings.
515+ void  PrintTo (const  char16_t * s, ::std::ostream* os);
518516inline  void  PrintTo (char16_t * s, ::std::ostream* os) {
519-   PrintTo (ImplicitCast_<const  void *>(s), os);
520- }
521- inline  void  PrintTo (const  char32_t * s, ::std::ostream* os) {
522-   PrintTo (ImplicitCast_<const  void *>(s), os);
517+   PrintTo (ImplicitCast_<const  char16_t *>(s), os);
523518}
519+ //  Overloads for u32 strings.
520+ void  PrintTo (const  char32_t * s, ::std::ostream* os);
524521inline  void  PrintTo (char32_t * s, ::std::ostream* os) {
525-   PrintTo (ImplicitCast_<const  void *>(s), os);
522+   PrintTo (ImplicitCast_<const  char32_t *>(s), os);
526523}
527524
528525//  MSVC can be configured to define wchar_t as a typedef of unsigned
@@ -558,6 +555,26 @@ inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
558555  PrintStringTo (s, os);
559556}
560557
558+ //  Overloads for ::std::u8string
559+ #ifdef  __cpp_char8_t
560+ GTEST_API_ void  PrintU8StringTo (const  ::std::u8string& s, ::std::ostream* os);
561+ inline  void  PrintTo (const  ::std::u8string& s, ::std::ostream* os) {
562+   PrintU8StringTo (s, os);
563+ }
564+ #endif 
565+ 
566+ //  Overloads for ::std::u16string
567+ GTEST_API_ void  PrintU16StringTo (const  ::std::u16string& s, ::std::ostream* os);
568+ inline  void  PrintTo (const  ::std::u16string& s, ::std::ostream* os) {
569+   PrintU16StringTo (s, os);
570+ }
571+ 
572+ //  Overloads for ::std::u32string
573+ GTEST_API_ void  PrintU32StringTo (const  ::std::u32string& s, ::std::ostream* os);
574+ inline  void  PrintTo (const  ::std::u32string& s, ::std::ostream* os) {
575+   PrintU32StringTo (s, os);
576+ }
577+ 
561578//  Overloads for ::std::wstring.
562579#if  GTEST_HAS_STD_WSTRING
563580GTEST_API_ void  PrintWideStringTo (const  ::std::wstring&s, ::std::ostream* os);
@@ -805,6 +822,20 @@ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
805822GTEST_API_ void  UniversalPrintArray (
806823    const  char * begin, size_t  len, ::std::ostream* os);
807824
825+ #ifdef  __cpp_char8_t
826+ //  This overload prints a (const) char8_t array compactly.
827+ GTEST_API_ void  UniversalPrintArray (const  char8_t * begin, size_t  len,
828+                                     ::std::ostream* os);
829+ #endif 
830+ 
831+ //  This overload prints a (const) char16_t array compactly.
832+ GTEST_API_ void  UniversalPrintArray (const  char16_t * begin, size_t  len,
833+                                     ::std::ostream* os);
834+ 
835+ //  This overload prints a (const) char32_t array compactly.
836+ GTEST_API_ void  UniversalPrintArray (const  char32_t * begin, size_t  len,
837+                                     ::std::ostream* os);
838+ 
808839//  This overload prints a (const) wchar_t array compactly.
809840GTEST_API_ void  UniversalPrintArray (
810841    const  wchar_t * begin, size_t  len, ::std::ostream* os);
@@ -877,12 +908,55 @@ class UniversalTersePrinter<const char*> {
877908  }
878909};
879910template  <>
880- class  UniversalTersePrinter <char *> {
911+ class  UniversalTersePrinter <char *> : public UniversalTersePrinter<const  char *> {
912+ };
913+ 
914+ #ifdef  __cpp_char8_t
915+ template  <>
916+ class  UniversalTersePrinter <const  char8_t *> {
917+  public: 
918+   static  void  Print (const  char8_t * str, ::std::ostream* os) {
919+     if  (str == nullptr ) {
920+       *os << " NULL"  ;
921+     } else  {
922+       UniversalPrint (::std::u8string (str), os);
923+     }
924+   }
925+ };
926+ template  <>
927+ class  UniversalTersePrinter <char8_t *>
928+     : public UniversalTersePrinter<const  char8_t *> {};
929+ #endif 
930+ 
931+ template  <>
932+ class  UniversalTersePrinter <const  char16_t *> {
933+  public: 
934+   static  void  Print (const  char16_t * str, ::std::ostream* os) {
935+     if  (str == nullptr ) {
936+       *os << " NULL"  ;
937+     } else  {
938+       UniversalPrint (::std::u16string (str), os);
939+     }
940+   }
941+ };
942+ template  <>
943+ class  UniversalTersePrinter <char16_t *>
944+     : public UniversalTersePrinter<const  char16_t *> {};
945+ 
946+ template  <>
947+ class  UniversalTersePrinter <const  char32_t *> {
881948 public: 
882-   static  void  Print (char * str, ::std::ostream* os) {
883-     UniversalTersePrinter<const  char *>::Print (str, os);
949+   static  void  Print (const  char32_t * str, ::std::ostream* os) {
950+     if  (str == nullptr ) {
951+       *os << " NULL"  ;
952+     } else  {
953+       UniversalPrint (::std::u32string (str), os);
954+     }
884955  }
885956};
957+ template  <>
958+ class  UniversalTersePrinter <char32_t *>
959+     : public UniversalTersePrinter<const  char32_t *> {};
886960
887961#if  GTEST_HAS_STD_WSTRING
888962template  <>
0 commit comments