浏览代码

Comment has been added to fix (issue #1266)

Antal Tátrai 9 年之前
父节点
当前提交
e2fb1d9822
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/google/protobuf/map.h

+ 4 - 0
src/google/protobuf/map.h

@@ -548,6 +548,10 @@ class Map {
     !defined(GOOGLE_PROTOBUF_OS_NACL) && !defined(GOOGLE_PROTOBUF_OS_ANDROID)
     template<class NodeType, class... Args>
     void construct(NodeType* p, 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)...);
     }