The some of the boost regression tests are using the following allocator:
namespace test
{
template <class T>
struct malloc_allocator
{
[...]
pointer allocate(size_type n, const_pointer u) { return allocate(n); }
[...]
};
}
The second parameter type is const_pointer, not
malloc_allocator<void>::const_pointer.
As a result these tests are failed with the error:
------------------------------------------------------------------------------------------------------------------
include\rw/_tree.cc(140) : error C2664:
'__rw::__rb_tree<_Key,_Val,_KeyOf,_Comp,_Alloc>::_C_node_buf
*test::malloc_allocator<T>::allocate(test::malloc_allocator<T>::size_type,const
__rw::__rb_tree<_Key,_Val,_KeyOf,_Comp,_Alloc>::_C_node_buf *)' : cannot
convert parameter 2 from 'void *' to 'const
__rw::__rb_tree<_Key,_Val,_KeyOf,_Comp,_Alloc>::_C_node_buf *'
------------------------------------------------------------------------------------------------------------------
The patch below fixes these problems.
ChangeLog:
* include/rw/_tree.cc (_C_add_new_buffer): Remove casting the second
parameter of the allocator(size, pointer) call to void*.
* include/list.cc (_C_add_buffer): Ditto.
* include/list (_C_get_node): Ditto.
------------------------------------------------------------------------------------------------------------------
Index: include/rw/_tree.cc
===================================================================
--- include/rw/_tree.cc (revision 614178)
+++ include/rw/_tree.cc (working copy)
@@ -137,11 +137,11 @@
__newsize = __bufsize + 1;
_C_buf_ptr_t __buf =
- _C_buf_alloc_t (*this).allocate (size_type (1), (void*)_C_buf_list);
+ _C_buf_alloc_t (*this).allocate (size_type (1), _C_buf_list);
_TRY {
__buf->_C_buffer =
- _C_node_alloc_t (*this).allocate (__newsize, (void*)_C_last);
+ _C_node_alloc_t (*this).allocate (__newsize, _C_last);
}
_CATCH (...) {
_C_buf_alloc_t (*this).deallocate (__buf, 1);
Index: include/list.cc
===================================================================
--- include/list.cc (revision 614178)
+++ include/list.cc (working copy)
@@ -86,12 +86,12 @@
}
}
_C_buf_pointer __tmp =
- _C_buf_alloc_type (*this).allocate (1, (void*)_C_buflist);
+ _C_buf_alloc_type (*this).allocate (1, _C_buflist);
_TRY {
__tmp->_C_buffer =
_C_node_alloc_type (*this).allocate (__next_buffer_size,
- (void*)_C_last);
+ _C_last);
}
_CATCH (...) {
_C_buf_alloc_type (*this).deallocate (__tmp, 1);
Index: include/list
===================================================================
--- include/list (revision 614178)
+++ include/list (working copy)
@@ -335,7 +335,7 @@
insert (b,e,v)
_C_link_type _C_get_node (bool = false) {
- return _C_node_alloc_type (*this).allocate (1, (void*)_C_last);
+ return _C_node_alloc_type (*this).allocate (1, _C_last);
}
void _C_put_node (_C_link_type __link) {
------------------------------------------------------------------------------------------------------------------
Farid.