summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gampe2017-09-19 22:34:45 -0500
committerAndreas Gampe2017-09-20 12:54:20 -0500
commit4ef5011a7b3b20703c58a1af0589e72b20812026 (patch)
treeec3f00202afbc5a0928b89d192ea5cc820f4ba63 /base/include
parent22a10f6766cd3ae07217b9a93c44381f52aa7018 (diff)
downloadplatform-system-core-4ef5011a7b3b20703c58a1af0589e72b20812026.tar.gz
platform-system-core-4ef5011a7b3b20703c58a1af0589e72b20812026.tar.xz
platform-system-core-4ef5011a7b3b20703c58a1af0589e72b20812026.zip
Base: Delete ostream<< with std::string*
In most reasonable cases, this is actually a bug. So delete the operator overload and let the compiler complain. Test: m Change-Id: I7d66ec2f33cc46588b6f549876241871f19ce995
Diffstat (limited to 'base/include')
-rw-r--r--base/include/android-base/logging.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/base/include/android-base/logging.h b/base/include/android-base/logging.h
index 548b286c4..f18cc0ca8 100644
--- a/base/include/android-base/logging.h
+++ b/base/include/android-base/logging.h
@@ -438,4 +438,14 @@ class ScopedLogSeverity {
438} // namespace base 438} // namespace base
439} // namespace android 439} // namespace android
440 440
441namespace std {
442
443// Delete << with string* to avoid mistakes. The intention was most likely to print *string.
444// If you really want to print the pointer, consider static_cast<void*>.
445//
446// Note: for this to work, we need to have this in a namespace.
447std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) = delete;
448
449} // namespace std
450
441#endif // ANDROID_BASE_LOGGING_H 451#endif // ANDROID_BASE_LOGGING_H