Commit 2fc23831 by Chaoran Yang

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 *.
parent 52998153
...@@ -152,8 +152,8 @@ class TypeWithoutFormatter { ...@@ -152,8 +152,8 @@ class TypeWithoutFormatter {
// This default version is called when kTypeKind is kOtherType. // This default version is called when kTypeKind is kOtherType.
static void PrintValue(const T& value, ::std::ostream* os) { static void PrintValue(const T& value, ::std::ostream* os) {
PrintBytesInObjectTo(static_cast<const unsigned char*>( PrintBytesInObjectTo(static_cast<const unsigned char*>(
reinterpret_cast<const void*>(&value)), reinterpret_cast<const void*>(
sizeof(value), os); std::addressof(value))), sizeof(value), os);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment