Bug 31729 - Nonconforming std::map
Summary: Nonconforming std::map
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-27 17:04 UTC by Ahti Legonkov
Modified: 2007-04-27 19:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahti Legonkov 2007-04-27 17:04:02 UTC
erase member functions of std::map class template do not conform to standard:

std::map<...>::erase(iterator) and std::map<...>::erase(iterator, iterator) both return void when they should return iterator (23.3.1):

bits/stl_map.h:444

      void
      erase(iterator __position)
      { _M_t.erase(__position); }

bits/stl_map.h:474

      void
      erase(iterator __first, iterator __last)
      { _M_t.erase(__first, __last); }


The standard requires signature of these functions to be:

      iterator erase(iterator);
      iterator erase(iterator, iterator);
Comment 1 Paolo Carlini 2007-04-27 17:26:02 UTC
I have the standard in front of me, both the printed version and the electronic version, and certainly you are wrong, both overloads return void.
Comment 2 Ahti Legonkov 2007-04-27 19:26:42 UTC
According to the working drafts http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2009.pdf and  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf I am right. But since they are drafts I may still be wrong.
Comment 3 Paolo Carlini 2007-04-27 19:31:53 UTC
Working drafts are working drafts, and therefore are about the *next* standard, not the current one, C++03. When the new standard will be out, and we'll provide a conforming implementation, breaking the ABI, we'll provide different overloads of erase and *a lot* of new / incompatible stuff.