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

             Bug #: 56170
           Summary: Extension debug_allocator seems non-compliant w.r.t.
                    rebind
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: atav...@gmail.com


It seems that the useful debug_allocator can only be used directly, not through
rebinding. If so, this limits its use in many situations. 

E.g., here is some code that tries to use it with a list:

<code>
#include <list>
#include <ext/debug_allocator.h>

using namespace std;

int main()
{
    list<int, __gnu_cxx::debug_allocator<std::allocator<int> > > a;

    return 0;
}
</code>

and here is the output:

<output>
In file included from /usr/include/c++/4.7/list:64:0,
                 from gcc.cpp:1:
/usr/include/c++/4.7/bits/stl_list.h: In instantiation of ‘class
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> > >’:
/usr/include/c++/4.7/bits/stl_list.h:436:11:   required from ‘class
std::list<int, __gnu_cxx::debug_allocator<std::allocator<int> > >’
gcc.cpp:8:66:   required from here
/usr/include/c++/4.7/bits/stl_list.h:307:9: error: no class template named
‘rebind’ in ‘class __gnu_cxx::debug_allocator<std::allocator<int> >’
/usr/include/c++/4.7/bits/stl_list.h:309:60: error: no class template named
‘rebind’ in ‘class __gnu_cxx::debug_allocator<std::allocator<int> >’
/usr/include/c++/4.7/bits/stl_list.h: In instantiation of ‘class std::list<int,
__gnu_cxx::debug_allocator<std::allocator<int> > >’:
gcc.cpp:8:66:   required from here
/usr/include/c++/4.7/bits/stl_list.h:469:20: error: no members matching
‘std::list<int, __gnu_cxx::debug_allocator<std::allocator<int> > >::_Base {aka
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> >
>}::_M_get_Tp_allocator’ in ‘std::list<int,
__gnu_cxx::debug_allocator<std::allocator<int> > >::_Base {aka class
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> > >}’
/usr/include/c++/4.7/bits/stl_list.h:470:20: error: no members matching
‘std::list<int, __gnu_cxx::debug_allocator<std::allocator<int> > >::_Base {aka
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> >
>}::_M_get_Node_allocator’ in ‘std::list<int,
__gnu_cxx::debug_allocator<std::allocator<int> > >::_Base {aka class
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> > >}’
In file included from /usr/include/c++/4.7/list:65:0,
                 from gcc.cpp:1:
/usr/include/c++/4.7/bits/list.tcc: In instantiation of ‘void
std::_List_base<_Tp, _Alloc>::_M_clear() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’:
/usr/include/c++/4.7/bits/stl_list.h:379:9:   required from
‘std::_List_base<_Tp, _Alloc>::~_List_base() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’
/usr/include/c++/4.7/bits/stl_list.h:436:11:   required from here
/usr/include/c++/4.7/bits/list.tcc:78:4: error: ‘_M_get_Tp_allocator’ was not
declared in this scope
In file included from /usr/include/c++/4.7/list:64:0,
                 from gcc.cpp:1:
/usr/include/c++/4.7/bits/stl_list.h: In instantiation of ‘std::_List_base<_Tp,
_Alloc>::_List_impl::_List_impl() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’:
/usr/include/c++/4.7/bits/stl_list.h:361:17:   required from
‘std::_List_base<_Tp, _Alloc>::_List_base() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’
/usr/include/c++/4.7/bits/stl_list.h:522:15:   required from ‘std::list<_Tp,
_Alloc>::list() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’
gcc.cpp:8:66:   required from here
/usr/include/c++/4.7/bits/stl_list.h:317:32: error: no class template named
‘rebind’ in ‘class __gnu_cxx::debug_allocator<std::allocator<int> >’
atavory@atavory-len:~$ g++ gcc.cpp > tmp.txt
atavory@atavory-len:~$ g++ gcc.cpp > tmp.txt
In file included from /usr/include/c++/4.7/list:64:0,
                 from gcc.cpp:1:
/usr/include/c++/4.7/bits/stl_list.h: In instantiation of ‘class
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> > >’:
/usr/include/c++/4.7/bits/stl_list.h:436:11:   required from ‘class
std::list<int, __gnu_cxx::debug_allocator<std::allocator<int> > >’
gcc.cpp:8:66:   required from here
/usr/include/c++/4.7/bits/stl_list.h:307:9: error: no class template named
‘rebind’ in ‘class __gnu_cxx::debug_allocator<std::allocator<int> >’
/usr/include/c++/4.7/bits/stl_list.h:309:60: error: no class template named
‘rebind’ in ‘class __gnu_cxx::debug_allocator<std::allocator<int> >’
/usr/include/c++/4.7/bits/stl_list.h: In instantiation of ‘class std::list<int,
__gnu_cxx::debug_allocator<std::allocator<int> > >’:
gcc.cpp:8:66:   required from here
/usr/include/c++/4.7/bits/stl_list.h:469:20: error: no members matching
‘std::list<int, __gnu_cxx::debug_allocator<std::allocator<int> > >::_Base {aka
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> >
>}::_M_get_Tp_allocator’ in ‘std::list<int,
__gnu_cxx::debug_allocator<std::allocator<int> > >::_Base {aka class
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> > >}’
/usr/include/c++/4.7/bits/stl_list.h:470:20: error: no members matching
‘std::list<int, __gnu_cxx::debug_allocator<std::allocator<int> > >::_Base {aka
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> >
>}::_M_get_Node_allocator’ in ‘std::list<int,
__gnu_cxx::debug_allocator<std::allocator<int> > >::_Base {aka class
std::_List_base<int, __gnu_cxx::debug_allocator<std::allocator<int> > >}’
In file included from /usr/include/c++/4.7/list:65:0,
                 from gcc.cpp:1:
/usr/include/c++/4.7/bits/list.tcc: In instantiation of ‘void
std::_List_base<_Tp, _Alloc>::_M_clear() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’:
/usr/include/c++/4.7/bits/stl_list.h:379:9:   required from
‘std::_List_base<_Tp, _Alloc>::~_List_base() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’
/usr/include/c++/4.7/bits/stl_list.h:436:11:   required from here
/usr/include/c++/4.7/bits/list.tcc:78:4: error: ‘_M_get_Tp_allocator’ was not
declared in this scope
In file included from /usr/include/c++/4.7/list:64:0,
                 from gcc.cpp:1:
/usr/include/c++/4.7/bits/stl_list.h: In instantiation of ‘std::_List_base<_Tp,
_Alloc>::_List_impl::_List_impl() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’:
/usr/include/c++/4.7/bits/stl_list.h:361:17:   required from
‘std::_List_base<_Tp, _Alloc>::_List_base() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’
/usr/include/c++/4.7/bits/stl_list.h:522:15:   required from ‘std::list<_Tp,
_Alloc>::list() [with _Tp = int; _Alloc =
__gnu_cxx::debug_allocator<std::allocator<int> >]’
gcc.cpp:8:66:   required from here
/usr/include/c++/4.7/bits/stl_list.h:317:32: error: no class template named
‘rebind’ in ‘class __gnu_cxx::debug_allocator<std::allocator<int> >’
</output>

  Thanks!

Reply via email to