[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 04:14:09 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=67851





--- Comment #4 from Iain Merrick <husky at google.com>  2011-09-12 04:14:09 PST ---
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.

If you don't include StringHash.h, it compiles, but I think it picks up the wrong HashTraits (because it's missing the template specialization). We're doing this a lot, so it seems important.

-- 
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