Strange Compile Error in HashMap/HashSet
Apparently, Microsoft Visual C++ 7.1 doesn't like HashMap: {snip}\JavaScriptCore\kxmlcore\HashMap.h(46) : error C2440: 'specialization' : cannot convert from 'T1::first_type (__cdecl *)(const T1 &)' to 'KXMLCore::HashMap<Key,Mapped,HashFunctions,KeyTraits,MappedTraits>::KeyType (__cdecl *)(const KXMLCore::HashMap<Key,Mapped,HashFunctions,KeyTraits,MappedTraits>::ValueType &)' None of the functions with this name in scope match the target type This error is fired in 2 cases: different calling conventions (not the case here, both using cdecl) or something I don't particularly understand (something along the lines like casting from a TemplateType<Bla> to a TemplateType). Any clues as to what its not liking? Relevant code: private: typedef HashTable<KeyType, ValueType, extractFirst<ValueType>, HashFunctions, ValueTraits> ImplType; I highly believe its the extractFirst<ValueType> that's causing the failure, which is defined as: template<typename PairType> inline typename PairType::first_type extractFirst(const PairType& value) { return value.first; } Thanks, Justin Haygood
I don't have an answer just 2 observations: 1. VC 2005 (8.0) handles this a little better i.e. it can compile but fails at link time: internal.obj : error LNK2019: unresolved external symbol "void * __cdecl KXMLCore::extractFirst<struct std::pair<void *,void *>
(struct std ::pair<void *,void *> const &)" (??$extractFirst@U?$pair@PAXPAX@std@@@KXMLCore@@YAPAXABU?$pair@PAXPAX@std@@@Z) referenced in function "priva te: static void * __cdecl KXMLCore::HashTable<void *,struct std::pair<void *,void *>,&void * __cdecl KXMLCore::extractFirst<struct std::pair <void *,void *> >(struct std::pair<void *,void *> const &),struct KXMLCore::DefaultHash<void *>,struct KXMLCore::PairHashTraits<struct KXMLC ore::HashTraits<void *>,struct KXMLCore::HashTraits<void *> > ::extractKey(struct std::pair<void *,void *> const &)" (?extractKey@?$HashTab le@PAXU?$pair@PAXPAX@std@@$1??$extractFirst@U?$pair@PAXPAX@std@@@KXMLCore@@YAPAXABU12@@ZU?$DefaultHash@PAX@3@U?$PairHashTraits@U?$HashTraits @PAX@KXMLCore@@U12@@3@@KXMLCore@@CAPAXABU?$pair@PAXPAX@std@@@Z) bin\testkjs.exe : fatal error LNK1120: 1 unresolved externals
2. #include <bits/cpp_type_traits.h> in kxmlcore\HashTraits.h is questionable. According to the source (http://www-evasion.imag.fr/Membres/Frank.Perbet/extdox/stl/html/cpp__type__t...) it's a private header for libstdc++ and should not be directly included by applications. -- kjk On 9/29/05, Justin Haygood <justin@xiondigital.net> wrote:
Apparently, Microsoft Visual C++ 7.1 doesn't like HashMap:
{snip}\JavaScriptCore\kxmlcore\HashMap.h(46) : error C2440: 'specialization' : cannot convert from 'T1::first_type (__cdecl *)(const T1 &)' to 'KXMLCore::HashMap<Key,Mapped,HashFunctions,KeyTraits,MappedTraits>::KeyType (__cdecl *)(const KXMLCore::HashMap<Key,Mapped,HashFunctions,KeyTraits,MappedTraits>::ValueType &)' None of the functions with this name in scope match the target type
This error is fired in 2 cases: different calling conventions (not the case here, both using cdecl) or something I don't particularly understand (something along the lines like casting from a TemplateType<Bla> to a TemplateType).
Any clues as to what its not liking?
Relevant code:
private: typedef HashTable<KeyType, ValueType, extractFirst<ValueType>, HashFunctions, ValueTraits> ImplType;
I highly believe its the extractFirst<ValueType> that's causing the failure, which is defined as:
template<typename PairType> inline typename PairType::first_type extractFirst(const PairType& value) { return value.first; }
Thanks, Justin Haygood _______________________________________________ webkit-dev mailing list webkit-dev@opendarwin.org http://www.opendarwin.org/mailman/listinfo/webkit-dev
participants (2)
-
Justin Haygood
-
Krzysztof Kowalczyk