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 c++/15373] New: STL Allocator issues with map and basic_string


I am using my custom allocator in STL map, with that I was facing some 
compilation issues. To identify the root cause I tried following sample code 
(test.cpp),

#include <stdio.h>
#include <stdlib.h>
#include <bits/stl_alloc.h>
#include <map>

using std::map;

using std::allocator;

typedef std::pair<int, int> intintpair;
typedef map<int, int, std::allocator<std::pair<int, int> > > IMAP;

int main()
{
                  IMAP mp;
                  mp.insert(std::make_pair(1,1));
                  return 0;
}

I am getting folloing compilation errors on RH 7.3 (gcc 3.0.4)
/opt/gcc/include/g++-v3/bits/stl_tree.h: In member function
   `std::pair<std::_Rb_tree_iterator<_Value, _Value&, _Value*>, bool>
   std::_Rb_tree<_Key, _Value, _KeyOfValue, _Compare,
   _Alloc>::insert_unique(const _Value&) [with _Key = int, _Value =
   std::pair<const int, int>, _KeyOfValue = std::_Select1st<std::pair<const
   int, int> >, _Compare = std::allocator<std::pair<int, int> >, _Alloc =
   std::allocator<std::pair<const int, int> >]':
/opt/gcc/include/g++-v3/bits/stl_map.h:167:   instantiated from 
`std::pair<typename std::_Rb_t
ree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, 
_Tp> >, _Compare,
_Alloc>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const 
std::pair<const _
Key, _Tp>&) [with _Key = int, _Tp = int, _Compare = 
std::allocator<std::pair<int, int> >, _All
oc = std::allocator<std::pair<const int, int> >]'
test.cpp:16:   instantiated from here
/opt/gcc/include/g++-v3/bits/stl_tree.h:900: no match for call to
   `(std::allocator<std::pair<int, int> >) (const int&, const int&)'
/opt/gcc/include/g++-v3/bits/stl_map.h:167:   instantiated from 
`std::pair<typename std::_Rb_t
ree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, 
_Tp> >, _Compare,
_Alloc>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const 
std::pair<const _
Key, _Tp>&) [with _Key = int, _Tp = int, _Compare = 
std::allocator<std::pair<int, int> >, _All
oc = std::allocator<std::pair<const int, int> >]'
test.cpp:16:   instantiated from here
/opt/gcc/include/g++-v3/bits/stl_tree.h:909: no match for call to
   `(std::allocator<std::pair<int, int> >) (const int&, const int&)'


I am using gcc 3.0.4
$gcc -v
Reading specs from /opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/specs
Configured with: ./configure --prefix=/opt/gcc --program-suffix=-3.0.4 --enable-
threads
Thread model: posix
gcc version 3.0.4

$ uname -r
2.4.18-3

$ uname -v
#1 Thu Apr 18 07:37:53 EDT 2002
$ uname -s
Linux

-- 
           Summary: STL Allocator issues with map and basic_string
           Product: gcc
           Version: 3.0.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ashwin_ambekar at persistent dot co dot in
                CC: gcc-bugs at gcc dot gnu dot org


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


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