summaryrefslogtreecommitdiffstats
path: root/base/string16.cc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 20:03:11 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 20:03:11 +0000
commit1599077a645a03c31c09efe57befaefbe00c958a (patch)
treedcf0702d4e1a241ce69e4e6a9968992f42ed4b68 /base/string16.cc
parentf27a0b59065835a9fe6f9a30681c36f14fe9edc3 (diff)
downloadchromium_src-1599077a645a03c31c09efe57befaefbe00c958a.zip
chromium_src-1599077a645a03c31c09efe57befaefbe00c958a.tar.gz
chromium_src-1599077a645a03c31c09efe57befaefbe00c958a.tar.bz2
Clang: make DCHECK_EQ(string16, string16) work.
The problem is that string16 is a typedef for a std::basic_string with a custom base::char_traits, hence ADL looks for operator<< only in std and base, not in the global namespace. Since adding stuff to the global namespace isn't permitted, move the operator to namespace base instead. Also give WebString an explicit operator<< because clang can't figure out that it can use WebString's |operator string16| to print WebStrings. string16 is just wstring on windows, and gtest has special code to make printing wstrings to non-wide ostreams work already, so nothing is required on windows. Fix a few other minor issues. Based on a patch by hans@chromium.org BUG=57294 TEST=still compiles with gcc, fewer build errors in tests with clang Review URL: http://codereview.chromium.org/3515003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string16.cc')
-rw-r--r--base/string16.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/base/string16.cc b/base/string16.cc
index f7eaf7e..69d10e7 100644
--- a/base/string16.cc
+++ b/base/string16.cc
@@ -69,8 +69,10 @@ char16* c16memset(char16* s, char16 c, size_t n) {
template class std::basic_string<char16, base::string16_char_traits>;
+namespace base {
std::ostream& operator<<(std::ostream& out, const string16& str) {
return out << UTF16ToUTF8(str);
}
+}
#endif // WCHAR_T_IS_UTF32