Ticket #57751: patch-src_3rdparty_webkit_Source_JavaScriptCore_wtf_HashSet_h

File patch-src_3rdparty_webkit_Source_JavaScriptCore_wtf_HashSet_h, 1.4 KB (added by devernay (Frédéric Devernay), 5 years ago)
Line 
1$OpenBSD$
2
3Prevent error from gcc 6:
4HashSet.h:191:32: error: could not convert ...
5from 'std::pair<WTF::HashTableIterator<...>, bool>'
6to 'std::pair<WTF::HashTableConstIteratorAdapter<...>, bool>'
7
8gcc 6 accepts 'pair<iterator, bool>(p.first, p.second)' but gcc 8
9needs 'iterator(p.first)' to convert the iterator.
10
11The iterator_const_cast for MSVC doesn't work in gcc 6.
12
13Index: src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
14--- src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h.orig
15+++ src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
16@@ -188,7 +188,8 @@ namespace WTF {
17 #if COMPILER(MSVC) && _MSC_VER >= 1700
18         return iterator_const_cast(m_impl.add(value));
19 #else
20-        return m_impl.add(value);
21+        pair<typename HashTableType::iterator, bool> p = m_impl.add(value);
22+        return pair<iterator, bool>(iterator(p.first), p.second);
23 #endif
24     }
25 
26@@ -201,7 +202,9 @@ namespace WTF {
27 #if COMPILER(MSVC) && _MSC_VER >= 1700
28         return iterator_const_cast(m_impl.template addPassingHashCode<T, T, Adapter>(value, value));
29 #else
30-        return m_impl.template addPassingHashCode<T, T, Adapter>(value, value);
31+        pair<typename HashTableType::iterator, bool> p =
32+            m_impl.template addPassingHashCode<T, T, Adapter>(value, value);
33+        return pair<iterator, bool>(iterator(p.first), p.second);
34 #endif
35     }
36