summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest/gtest-printers.h
diff options
context:
space:
mode:
authorChaoran Yang <chaorany@me.com>2019-05-12 00:14:54 +0000
committerChaoran Yang <chaorany@me.com>2019-05-12 00:14:54 +0000
commit2fc2383165373ff62160487b729222557888d1fa (patch)
treefc4486fe96daf286087f8b9ee1c329e67e64e8f0 /googletest/include/gtest/gtest-printers.h
parent52998153774597546019359d1ac017766ea5d56a (diff)
downloadgoogletest-2fc2383165373ff62160487b729222557888d1fa.tar.gz
googletest-2fc2383165373ff62160487b729222557888d1fa.zip
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 *.
Diffstat (limited to 'googletest/include/gtest/gtest-printers.h')
-rw-r--r--googletest/include/gtest/gtest-printers.h4
1 files 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<const unsigned char*>(
- reinterpret_cast<const void*>(&value)),
- sizeof(value), os);
+ reinterpret_cast<const void*>(
+ std::addressof(value))), sizeof(value), os);
}
};
OpenPOWER on IntegriCloud