From 672db6ba31e288477e92f20fd80ae2d91e32dd39 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 21 Aug 2015 16:05:40 +0900 Subject: [PATCH] Bug 1189967 - Avoid including from Char16.h. r=nfroyd Since Char16.h is included everywhere, and MSVC 2015 uses the char16ptr_t trick it contains, we include everywhere, but that has the side effect of breaking the build in subtle ways. One way around this would be to avoid including Char16.h in the first place, but that requires more work than I was ready to put in. So instead, just avoid including by removing the conversion operator for std::wstring. --- mfbt/Char16.h | 6 +----- mfbt/Compression.cpp | 5 +++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mfbt/Char16.h b/mfbt/Char16.h index 1d7434c1e017..91cbc2878169 100644 --- a/mfbt/Char16.h +++ b/mfbt/Char16.h @@ -49,7 +49,7 @@ typedef unsigned int char32_t; #endif #ifdef MOZ_USE_CHAR16_WRAPPER -# include +# include /** * Win32 API extensively uses wchar_t, which is represented by a separated * builtin type than char16_t per spec. It's not the case for MSVC prior to @@ -93,10 +93,6 @@ public: { return mPtr != nullptr; } - operator std::wstring() const - { - return std::wstring(static_cast(*this)); - } /* Explicit cast operators to allow things like (char16_t*)str. */ explicit operator char16_t*() const diff --git a/mfbt/Compression.cpp b/mfbt/Compression.cpp index 154cef1031a6..c114c6c0fc8d 100644 --- a/mfbt/Compression.cpp +++ b/mfbt/Compression.cpp @@ -7,6 +7,11 @@ #include "mozilla/Compression.h" #include "mozilla/CheckedInt.h" +// Without including , MSVC 2015 complains about e.g. the impossibility +// to convert `const void* const` to `void*` when calling memchr from +// corecrt_memory.h. +#include + using namespace mozilla::Compression; namespace {