Skip to content

Commit

Permalink
Merge pull request #3993 from pgroke-dt:work-around-GCC-11-ADL-bug
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 523706897
Change-Id: If6dcc97c81a20f8fe675241518ae1d6cf23ebf39
  • Loading branch information
Copybara-Service committed Apr 12, 2023
2 parents 8fa9461 + 096014a commit 12a5852
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions googletest/include/gtest/gtest-printers.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,13 @@ struct StreamPrinter {
// Don't accept member pointers here. We'd print them via implicit
// conversion to bool, which isn't useful.
typename = typename std::enable_if<
!std::is_member_pointer<T>::value>::type,
// Only accept types for which we can find a streaming operator via
// ADL (possibly involving implicit conversions).
typename = decltype(std::declval<std::ostream&>()
<< std::declval<const T&>())>
static void PrintValue(const T& value, ::std::ostream* os) {
!std::is_member_pointer<T>::value>::type>
// Only accept types for which we can find a streaming operator via
// ADL (possibly involving implicit conversions).
// (Use SFINAE via return type, because it seems GCC < 12 doesn't handle name
// lookup properly when we do it in the template parameter list.)
static auto PrintValue(const T& value, ::std::ostream* os)
-> decltype((void)(*os << value)) {
// Call streaming operator found by ADL, possibly with implicit conversions
// of the arguments.
*os << value;
Expand Down

0 comments on commit 12a5852

Please sign in to comment.