Index: third_party/protobuf/patches/0006-fix-clang-type-errors.patch |
diff --git a/third_party/protobuf/patches/0006-fix-clang-type-errors.patch b/third_party/protobuf/patches/0006-fix-clang-type-errors.patch |
new file mode 100644 |
index 0000000000000000000000000000000000000000..481ecb86becdb44fab35c7d9ff9056db1a543187 |
--- /dev/null |
+++ b/third_party/protobuf/patches/0006-fix-clang-type-errors.patch |
@@ -0,0 +1,21 @@ |
+--- protobuf-cleaned/src/google/protobuf/map.h 2015-12-30 13:21:46.000000000 -0800 |
++++ protobuf-patched/src/google/protobuf/map.h 2016-03-31 13:25:36.968011603 -0700 |
+@@ -545,10 +545,16 @@ |
+ } |
+ |
+ #if __cplusplus >= 201103L && !defined(GOOGLE_PROTOBUF_OS_APPLE) && \ |
+- !defined(GOOGLE_PROTOBUF_OS_NACL) && !defined(GOOGLE_PROTOBUF_OS_ANDROID) |
++ !defined(GOOGLE_PROTOBUF_OS_NACL) && \ |
++ !defined(GOOGLE_PROTOBUF_OS_ANDROID) && \ |
++ !defined(GOOGLE_PROTOBUF_OS_EMSCRIPTEN) |
+ template<class NodeType, class... Args> |
+ void construct(NodeType* p, Args&&... args) { |
+- new (static_cast<void*>(p)) NodeType(std::forward<Args>(args)...); |
++ // Clang 3.6 doesn't compile static casting to void* directly. (Issue #1266) |
++ // According C++ standard 5.2.9/1: "The static_cast operator shall not cast |
++ // away constness". So first the maybe const pointer is casted to const void* and |
++ // after the const void* is const casted. |
++ new (const_cast<void*>(static_cast<const void*>(p))) NodeType(std::forward<Args>(args)...); |
+ } |
+ |
+ template<class NodeType> |