@@ -225,17 +225,12 @@ void MakeCheckOpValueString(std::ostream& os, signed char v);
225225void MakeCheckOpValueString (std::ostream& os, unsigned char v);
226226void MakeCheckOpValueString (std::ostream& os, const void * absl_nullable p);
227227
228- void MakeCheckOpUnprintableString (std::ostream& os);
229-
230228// A wrapper for types that have no operator<<.
231229struct UnprintableWrapper {
232230 template <typename T>
233231 explicit UnprintableWrapper (const T&) {}
234232
235- friend std::ostream& operator <<(std::ostream& os, const UnprintableWrapper&) {
236- MakeCheckOpUnprintableString (os);
237- return os;
238- }
233+ friend std::ostream& operator <<(std::ostream& os, UnprintableWrapper);
239234};
240235
241236namespace detect_specialization {
@@ -400,10 +395,16 @@ ABSL_ATTRIBUTE_RETURNS_NONNULL const char* absl_nonnull MakeCheckOpString(
400395template <typename T1, typename T2>
401396const char * absl_nonnull MakeCheckOpString (T1 v1, T2 v2,
402397 const char * absl_nonnull exprtext) {
403- CheckOpMessageBuilder comb (exprtext);
404- MakeCheckOpValueString (comb.ForVar1 (), v1);
405- MakeCheckOpValueString (comb.ForVar2 (), v2);
406- return comb.NewString ();
398+ if constexpr (std::is_same_v<CheckOpStreamType<T1>, UnprintableWrapper> &&
399+ std::is_same_v<CheckOpStreamType<T2>, UnprintableWrapper>) {
400+ // No sense printing " (UNPRINTABLE vs. UNPRINTABLE)"
401+ return exprtext;
402+ } else {
403+ CheckOpMessageBuilder comb (exprtext);
404+ MakeCheckOpValueString (comb.ForVar1 (), v1);
405+ MakeCheckOpValueString (comb.ForVar2 (), v2);
406+ return comb.NewString ();
407+ }
407408}
408409
409410// Add a few commonly used instantiations as extern to reduce size of objects
0 commit comments