This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug libstdc++/57065] New: incorrect default allocator template for debug and profile unordered_map


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57065

             Bug #: 57065
           Summary: incorrect default allocator template for debug and
                    profile unordered_map
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: theonetruekenny@yahoo.com


In libstdc++-v3/include/debug/unordered_map and
libstdc++-v3/include/profile/unorderd_map, the unordered_map template is
defined as:

  template<typename _Key, typename _Tp,
           typename _Hash = std::hash<_Key>,
           typename _Pred = std::equal_to<_Key>,
           typename _Alloc = std::allocator<_Key> >
    class unordered_map

however, the correct definition (as reflected in bits/unordered_map.h) is: 
   *  @param  Pred  Predicate function object type, defaults to
equal_to<Value>.
   *  @param  Alloc  Allocator type, defaults to allocator<Key>.
   *
   * The resulting value type of the container is std::pair<const Key, Tp>.
   */
  template<class _Key, class _Tp,
           class _Hash = hash<_Key>,
           class _Pred = std::equal_to<_Key>,
           class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
    class unordered_map

note that the comment is wrong, but the code is correct.

See also: http://www.cplusplus.com/reference/unordered_map/unordered_map/ which
matches the definition in bits/unordered_map.h

As far as I can tell, this error has existed since gcc 4.3.


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