From 2fc2383165373ff62160487b729222557888d1fa Mon Sep 17 00:00:00 2001 From: Chaoran Yang Date: Sun, 12 May 2019 00:14:54 +0000 Subject: [PATCH] Use std::addressof to instead of plain '&'. Otherwise the code won't compile if the '&' operater is overloaded and return something that cannot be casted to void *. --- googletest/include/gtest/gtest-printers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 97cdb2a2..5a3ca821 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -152,8 +152,8 @@ class TypeWithoutFormatter { // This default version is called when kTypeKind is kOtherType. static void PrintValue(const T& value, ::std::ostream* os) { PrintBytesInObjectTo(static_cast( - reinterpret_cast(&value)), - sizeof(value), os); + reinterpret_cast( + std::addressof(value))), sizeof(value), os); } };