Bug 69414 - Using RetainPtr as the key type in HashMap/HashSet fails to compile
Summary: Using RetainPtr as the key type in HashMap/HashSet fails to compile
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Adam Roben (:aroben)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-10-05 05:20 PDT by Adam Roben (:aroben)
Modified: 2011-10-05 15:22 PDT (History)
3 users (show)

See Also:


Attachments
Ensure RetainPtr::hashTableDeletedValue returns a pointer, not a pointer to a pointer (15.98 KB, patch)
2011-10-05 05:37 PDT, Adam Roben (:aroben)
sullivan: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>