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

             Bug #: 55409
           Summary: std::list not properly wrapping access to custom
                    allocator through allocator_traits
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: benjamin.kirc...@gmail.com


Created attachment 28741
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28741
Small example showing simple custom allocator with std::list and std::vector

The attached source file compiles fine with a std::vector as container_type.
Using std::list however, compilation fails with the error message given below.
Expected behavior is that it compiles with std::list as like with std::vector.

$ gcc --version
gcc (Debian 4.7.2-4) 4.7.2


$ cat main.cpp
template<typename T> class my_alloc
{
    // class template supporting the minimal interface according to 17.6.3.5
};

int main()
{
    //typedef std::vector<int, my_alloc<int>> container_type;
    typedef std::list<int, my_alloc<int>> container_type;
    container_type cont;
    cont.push_back(11);
    cont.push_back(22);
    cont.push_back(33);
    return 0;
}


$ g++ -g -std=c++11 -Wall -Wextra -pedantic main.cpp
<snip>
/usr/include/c++/4.7/bits/stl_list.h: In instantiation of ‘class std::list<int,
my_alloc<int> >’:
main.cpp:56:20:   required from here
/usr/include/c++/4.7/bits/stl_list.h:449:58: error: no type named ‘pointer’ in
‘std::list<int, my_alloc<int> >::_Tp_alloc_type {aka class my_alloc<int>}’
/usr/include/c++/4.7/bits/stl_list.h:450:58: error: no type named
‘const_pointer’ in ‘std::list<int, my_alloc<int> >::_Tp_alloc_type {aka class
my_alloc<int>}’
/usr/include/c++/4.7/bits/stl_list.h:451:58: error: no type named ‘reference’
in ‘std::list<int, my_alloc<int> >::_Tp_alloc_type {aka class my_alloc<int>}’
/usr/include/c++/4.7/bits/stl_list.h:452:58: error: no type named
‘const_reference’ in ‘std::list<int, my_alloc<int> >::_Tp_alloc_type {aka class
my_alloc<int>}’
<snip>
and so on.

Reply via email to