Bug 69414

Summary: Using RetainPtr as the key type in HashMap/HashSet fails to compile
Product: WebKit Reporter: Adam Roben (:aroben) <aroben>
Component: Web Template FrameworkAssignee: Adam Roben (:aroben) <aroben>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, sullivan, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Ensure RetainPtr::hashTableDeletedValue returns a pointer, not a pointer to a pointer sullivan: review+

Description Adam Roben (:aroben) 2011-10-05 05:20:47 PDT
The following code fails to compile:

HashSet<RetainPtr<CFStringRef> > set;

Here are some of the errors:



JavaScriptCore.framework/PrivateHeaders/RetainPtr.h:70:61:{70:55-70:60}{70:64-70:87}: error: comparison of distinct pointer types ('PtrType' (aka 'const __CFString *') and 'const __CFString **') [2]
         bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
                                                       ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~
JavaScriptCore.framework/PrivateHeaders/HashTraits.h:90:67: note: in instantiation of member function 'WTF::RetainPtr<const __CFString *>::isHashTableDeletedValue' requested here [2]
         static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); }
                                                                   ^
JavaScriptCore.framework/PrivateHeaders/HashTable.h:342:81: note: in instantiation of member function 'WTF::SimpleClassHashTraits<WTF::RetainPtr<const __CFString *> >::isDeletedValue' requested here [2]
         static bool isDeletedBucket(const ValueType& value) { return KeyTraits::isDeletedValue(Extractor::extract(value)); }
                                                                                 ^
JavaScriptCore.framework/PrivateHeaders/HashTable.h:891:22: note: in instantiation of member function 'WTF::HashTable<WTF::RetainPtr<const __CFString *>, WTF::RetainPtr<const __CFString *>, WTF::IdentityExtractor<WTF::RetainPtr<const __CFString *> >, WTF::PtrHash<WTF::RetainPtr<const __CFString *> >, WTF::HashTraits<WTF::RetainPtr<const __CFString *> >, WTF::HashTraits<WTF::RetainPtr<const __CFString *> > >::isDeletedBucket' requested here [2]
                 if (!isDeletedBucket(table[i]))
                      ^
JavaScriptCore.framework/PrivateHeaders/HashTable.h:300:13: note: in instantiation of member function 'WTF::HashTable<WTF::RetainPtr<const __CFString *>, WTF::RetainPtr<const __CFString *>, WTF::IdentityExtractor<WTF::RetainPtr<const __CFString *> >, WTF::PtrHash<WTF::RetainPtr<const __CFString *> >, WTF::HashTraits<WTF::RetainPtr<const __CFString *> >, WTF::HashTraits<WTF::RetainPtr<const __CFString *> > >::deallocateTable' requested here [2]
             deallocateTable(m_table, m_tableSize); 
             ^
JavaScriptCore.framework/PrivateHeaders/HashSet.h:38:59: note: in instantiation of member function 'WTF::HashTable<WTF::RetainPtr<const __CFString *>, WTF::RetainPtr<const __CFString *>, WTF::IdentityExtractor<WTF::RetainPtr<const __CFString *> >, WTF::PtrHash<WTF::RetainPtr<const __CFString *> >, WTF::HashTraits<WTF::RetainPtr<const __CFString *> >, WTF::HashTraits<WTF::RetainPtr<const __CFString *> > >::~HashTable' requested here [2]
         typename TraitsArg = HashTraits<ValueArg> > class HashSet {
                                                           ^
Comment 1 Radar WebKit Bug Importer 2011-10-05 05:21:03 PDT
<rdar://problem/10236833>
Comment 2 Adam Roben (:aroben) 2011-10-05 05:30:19 PDT
Looks like HashMap<RetainPtr<CFStringRef>, int> also fails to compile.
Comment 3 Adam Roben (:aroben) 2011-10-05 05:37:50 PDT
Created attachment 109777 [details]
Ensure RetainPtr::hashTableDeletedValue returns a pointer, not a pointer to a pointer
Comment 4 Adam Roben (:aroben) 2011-10-05 15:22:16 PDT
Committed r96757: <http://trac.webkit.org/changeset/96757>