summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCopybara-Service <copybara-worker@google.com>2023-04-12 15:28:57 (GMT)
committerCopybara-Service <copybara-worker@google.com>2023-04-12 15:28:57 (GMT)
commit12a5852e451baabc79c63a86c634912c563d57bc (patch)
treed76aba1d383ac6ed64eb945dceee5dc625b95078
parent8fa9461cc28e053d66f17132808d287ae51575e2 (diff)
parent096014a45dc38dff993f5b7bb28a258d8323344b (diff)
downloadgoogletest-12a5852e451baabc79c63a86c634912c563d57bc.zip
googletest-12a5852e451baabc79c63a86c634912c563d57bc.tar.gz
googletest-12a5852e451baabc79c63a86c634912c563d57bc.tar.bz2
Merge pull request #3993 from pgroke-dt:work-around-GCC-11-ADL-bug
PiperOrigin-RevId: 523706897 Change-Id: If6dcc97c81a20f8fe675241518ae1d6cf23ebf39
-rw-r--r--googletest/include/gtest/gtest-printers.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h
index a0c1984..539d99c 100644
--- a/googletest/include/gtest/gtest-printers.h
+++ b/googletest/include/gtest/gtest-printers.h
@@ -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;