[Webkit-unassigned] [Bug 67851] WTFString.h should include template specialization for HashTraits<String>
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Sep 12 09:55:31 PDT 2011
https://bugs.webkit.org/show_bug.cgi?id=67851
--- Comment #5 from Sam Weinig <sam at webkit.org> 2011-09-12 09:55:31 PST ---
(In reply to comment #4)
> This code doesn't compile and I think it should:
>
> #include <wtf/HashSet.h>
> #include <wtf/text/WTFString.h>
>
> class ScoobyDoo {
> HashSet<String> scrappy;
> };
>
> #include <wtf/text/StringHash.h>
>
> Here's the error I get:
>
> wtf/text/StringHash.h: At global scope:
> wtf/text/StringHash.h:182: error: specialization of ‘WTF::HashTraits<WTF::String>’ after instantiation
> wtf/text/StringHash.h:182: error: redefinition of ‘struct WTF::HashTraits<WTF::String>’
> wtf/HashTraits.h:57: error: previous definition of ‘struct WTF::HashTraits<WTF::String>’
> In file included from wtf/text/StringImpl.h:33,
> from wtf/text/WTFString.h:28,
>
> This can occur if one header file includes HashSet.h and String.h and declares a HashSet<String> (perfectly reasonable on its own) and then a later header file includes StringHash.h. I hit this in a unit test I'm working on, so it's not theoretical.
I don't think it is perfectly reasonable. I believe you are supposed to #include <wtf/text/StringHash.h> if you want to use a HashSet<String>. Perhaps we should make it easier to ensure you are doing this right, but I am not sure #including <wtf/HashTraits.h> everywhere we #include <wtf/text/WTFString.h> is the right way to go (it might be though.)
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list