This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc-4.2.3: unordered_map implementation causes Insure++ PARSE_ERROR


I use Parasoft's Insure++ memory usage analysis tool to detect invalid memory
accesses and memory leaks. This tool performs both static and dynamic memory
usage analysis by instrumenting the code during the compilation and link
phases. Due to a PARSE_ERROR, Insure++ fails to compile code that uses
unordered_map:

         [hashtable:181] **PARSE_ERROR**

            Parse error.
         >>       template<typename _Key2, typename _Pair, typename
_Hashtable>
         too few template parameters -- does not match previous declaration

The parse error occurs at line 181 of hashtable [i.e.
/usr/include/c++/4.2.3/tr1/hashtable]:

         181    template<typename _Key2, typename _Pair, typename
_Hashtable>
         182       friend struct __detail::_Map_base;

where there appears to be an invalid friend declaration [i.e. "too few [3]
template parameters"]. The specified parameterized struct,
__detail::_Map_base, was defined with five parameters in hashtable_policy.h
as:

         615    template<typename _Key, typename _Value, typename _Ex, bool
__unique,
         616                 typename _Hashtable>
         617      struct _Map_base { };

so it seems entirely reasonable that the friendship declaration should also
employ five parameters.

I modified the friendship declaration to conform with my expectations as
follows (NOTE: there are five parameters):

         181    template<typename _Key, typename _Value, typename _Ex, bool
__unique,
         182                  typename _Hashtable>
         183      friend struct __detail::_Map_base;

and now Insure++ successfully parses the code, gcc successfully parses the
code, and my application continues to behave correctly.

QUESTION: Does anyone (with authority on the subject) agree that the current
friendship declaration is incorrect? If so, need I do more than I have to
realize a fix in a future release of gcc/libstdc++?

BTW - My apologies if I've posted to an inappropriate forum; Gnu - Common
C++ seems inactive.

... Dave
-- 
View this message in context: http://www.nabble.com/gcc-4.2.3%3A-unordered_map-implementation-causes-Insure%2B%2B-PARSE_ERROR-tp18944279p18944279.html
Sent from the gcc - libstdc++ mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]