[Bug libstdc++/17866] std::allocator fails on CV-related types

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Wed Oct 6 19:51:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-10-06 19:51 -------
If anything, then this is a libstdc++ problem. It reads basically like 
this: 
----------------------------- 
template<typename _Tp> 
class __mt_alloc_base 
{ 
  public: 
    typedef _Tp* pointer; 
    typedef const _Tp* const_pointer; 
    typedef _Tp& reference; 
    typedef const _Tp& const_reference; 
    typedef _Tp value_type; 
 
    pointer 
    address(reference __x) const; 
 
    const_pointer 
    address(const_reference __x) const; 
}; 
 
template class __mt_alloc_base<const int>; 
----------------------------- 
for which we get this (probably justified) error: 
 
g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -c a.cc  
a.cc: In instantiation of `__mt_alloc_base<const int>': 
a.cc:18:   instantiated from here 
a.cc:15: error: `const _Tp* __mt_alloc_base<_Tp>::address(const _Tp&) const 
[with _Tp = const int]' and `_Tp* __mt_alloc_base<_Tp>::address(_Tp&) const 
[with _Tp = const int]' cannot be overloaded 
 
I don't know whether the library is supposed to put up with allocators 
for constant elements. As one data point, icc can. If gcc wanted to do the 
same, then it would probably have to have a specialization of the 
allocator for constant arguments. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |libstdc++


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



More information about the Gcc-bugs mailing list