error calling std::allocator::allocate() from user-defined allocator
--------------------------------------------------------------------
Key: STDCXX-744
URL: https://issues.apache.org/jira/browse/STDCXX-744
Project: C++ Standard Library
Issue Type: Bug
Components: 20. General Utilities
Affects Versions: 4.2.0
Environment: gcc 4.1.2
Reporter: Martin Sebor
The program below reduced from Plum Hall test case
{{lvs07a/t237.dir/_23252Y11.cpp}} fails to compile with both the head of trunk
and stdcxx 4.2.0. It compiles fine with gcc 4.1.2.
{noformat}
$ cat t.cpp && make t
#include <memory>
#include <vector>
template <class T>
struct Allocator: std::allocator<T> {
T* allocate (unsigned n, const T *p) {
return std::allocator<T>::allocate (n, p);
}
};
int main () {
std::vector<int, Allocator<int> > v (2, 3);
}
gcc -c -I$TOPDIRinclude/ansi -D_RWSTDDEBUG -I$TOPDIRinclude
-I/build/sebor/stdcxx-gcc-4.1.2-11S-LVS/include -I$TOPDIRinclude/ansi
-I/build/sebor/PlumHall/lvs07a/conform -I/build/sebor/PlumHall/lvs07a/dst.3
-pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow
-Wwrite-strings -Wno-long-long -Wcast-align t.cpp
$TOPDIRinclude/vector.cc: In member function 'void std::vector<_TypeT,
_Allocator>::_C_realloc(typename _Allocator::size_type) [with _TypeT = int,
_Allocator = Allocator<int>]':
$TOPDIRinclude/vector:501: instantiated from 'void std::vector<_TypeT,
_Allocator>::reserve(typename _Allocator::size_type) [with _TypeT = int, _A
llocator = Allocator<int>]'
$TOPDIRinclude/vector.cc:219: instantiated from 'void std::vector<_TypeT,
_Allocator>::_C_insert_n(const _rw::__rw_debug_iter<std::vector<_TypeT,
_Allocator>, typename _Allocator::pointer, typename _Allocator::pointer>&,
typename _Allocator::size_type, typename _Allocator::const_reference) [with
_TypeT = int, _Allocator = Allocator<int>]'
$TOPDIRinclude/vector:301: instantiated from 'void std::vector<_TypeT,
_Allocator>::insert(__rw::__rw_debug_iter<std::vector<_TypeT, _Allocator>,
typename _Allocator::pointer, typename _Allocator::pointer>, typename
_Allocator::size_type, typename _Allocator::const_reference) [with _TypeT =
int, _Allocator = Allocator<int>]'
$TOPDIRinclude/vector.cc:152: instantiated from 'void std::vector<_TypeT,
_Allocator>::_C_assign_n(typename _Allocator::size_type, typename
_Allocator::const_reference) [with _TypeT = int, _Allocator = Allocator<int>]'
$TOPDIRinclude/vector:362: instantiated from 'void std::vector<_TypeT,
_Allocator>::_C_assign(_IntType, _IntType, int) [with _IntType = int, _Type
T = int, _Allocator = Allocator<int>]'
$TOPDIRinclude/vector:194: instantiated from 'void std::vector<_TypeT,
_Allocator>::assign(_InputIter, _InputIter) [with _InputIter = int, _TypeT =
int, _Allocator = Allocator<int>]'
$TOPDIRinclude/vector:173: instantiated from 'std::vector<_TypeT,
_Allocator>::vector(_InputIter, _InputIter, const _Allocator&) [with _InputIter
= int, _TypeT = int, _Allocator = Allocator<int>]'
t.cpp:12: instantiated from here
$TOPDIRinclude/vector.cc:85: error: no matching function for call to
'std::vector<int, Allocator<int> >::allocate(long unsigned int&,
std::vector<int, Allocator<int> >* const)'
t.cpp:6: note: candidates are: T* Allocator<T>::allocate(unsigned int, const
T*) [with T = int]
make: *** [t.o] Error 1
{noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.