Subject: [Boost-bugs] [Boost C++ Libraries] #1596: [unordered] non-standard prototype of malloc_allocator<>::allocate (size_t, const_pointer)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-01-23 11:11:18
#1596: [unordered] non-standard prototype of malloc_allocator<>::allocate (size_t,
const_pointer)
-------------------------------------+--------------------------------------
Reporter: faridz_at_[hidden] | Owner: danieljames
Type: Bugs | Status: new
Milestone: Boost 1.35.0 | Component: unordered
Version: Boost Development Trunk | Severity: Showstopper
Keywords: |
-------------------------------------+--------------------------------------
The [http://stdcxx.apache.org/ stdcxx] is the another implementation of
the STL (initially based on RogueWave STL).
The following errors are encountered when running boost regression
tests on msvc with stdcxx-4.2.0.
{{{
assign_exception_tests.cpp
D:\stdcxx\4.2.x\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 *'
with
[
_Key=test::detail::memory_area,
_Val=std::pair<const
test::detail::memory_area,test::detail::memory_track>,
_KeyOf=__rw::__select1st<std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area>,
_Comp=test::detail::memory_area_compare,
_Alloc=test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>,
T=__rw::__rb_tree<test::detail::memory_area,std::pair<const
test::detail::memory_area,test::detail::memory_track>,__rw::__select1st<std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area>,test::detail::memory_area_compare,test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>>::_C_node_buf
]
and
[
_Key=test::detail::memory_area,
_Val=std::pair<const
test::detail::memory_area,test::detail::memory_track>,
_KeyOf=__rw::__select1st<std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area>,
_Comp=test::detail::memory_area_compare,
_Alloc=test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>
]
Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
D:\stdcxx\4.2.x\include\rw/_tree.cc(131) : while compiling class
template member function 'void
__rw::__rb_tree<_Key,_Val,_KeyOf,_Comp,_Alloc>::_C_add_new_buffer(void)'
with
[
_Key=test::detail::memory_area,
_Val=std::pair<const
test::detail::memory_area,test::detail::memory_track>,
_KeyOf=__rw::__select1st<std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area>,
_Comp=test::detail::memory_area_compare,
_Alloc=test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>
]
D:\stdcxx\4.2.x\include\rw/_tree.cc(50) : while compiling class
template member function
'__rw::__rb_tree<_Key,_Val,_KeyOf,_Comp,_Alloc>::__rb_tree(const
test::detail::memory_area_compare &,const test::malloc_allocator<T> &)'
with
[
_Key=test::detail::memory_area,
_Val=std::pair<const
test::detail::memory_area,test::detail::memory_track>,
_KeyOf=__rw::__select1st<std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area>,
_Comp=test::detail::memory_area_compare,
_Alloc=test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>,
T=std::pair<const
test::detail::memory_area,test::detail::memory_track>
]
D:\stdcxx\4.2.x\include\map(89) : see reference to class template
instantiation '__rw::__rb_tree<_Key,_Val,_KeyOf,_Comp,_Alloc>' being
compiled
with
[
_Key=test::detail::memory_area,
_Val=std::pair<const
test::detail::memory_area,test::detail::memory_track>,
_KeyOf=__rw::__select1st<std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area>,
_Comp=test::detail::memory_area_compare,
_Alloc=test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>
]
d:\boost\boost\libs\unordered\test\objects\./memory.hpp(84) : see
reference to class template instantiation
'std::map<_Key,_TypeT,_Compare,_Allocator>' being compiled
with
[
_Key=test::detail::memory_area,
_TypeT=test::detail::memory_track,
_Compare=test::detail::memory_area_compare,
_Allocator=test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>
]
d:\boost\boost\libs\unordered\test\exception\../objects/exception.hpp(27)
: see reference to class template instantiation
'test::detail::memory_tracker<Alloc>' being compiled
with
[
Alloc=test::malloc_allocator<int>
]
D:\stdcxx\4.2.x\include\rw/_tree.cc(144) : error C2664:
'__rw::__rw_rb_tree_node<_Alloc,_Val,_Key,_KeyOf>
*test::malloc_allocator<T>::allocate(test::malloc_allocator<T>::size_type,const
__rw::__rw_rb_tree_node<_Alloc,_Val,_Key,_KeyOf> *)' : cannot convert
parameter 2 from 'void *' to 'const
__rw::__rw_rb_tree_node<_Alloc,_Val,_Key,_KeyOf> *'
with
[
_Alloc=test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>,
_Val=std::pair<const
test::detail::memory_area,test::detail::memory_track>,
_Key=test::detail::memory_area,
_KeyOf=__rw::__select1st<std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area>,
T=__rw::__rw_rb_tree_node<test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>,std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area,__rw::__select1st<std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area>>
]
and
[
_Alloc=test::malloc_allocator<std::pair<const
test::detail::memory_area,test::detail::memory_track>>,
_Val=std::pair<const
test::detail::memory_area,test::detail::memory_track>,
_Key=test::detail::memory_area,
_KeyOf=__rw::__select1st<std::pair<const
test::detail::memory_area,test::detail::memory_track>,test::detail::memory_area>
]
Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
}}}
By the standard, the type of the second parameter of allocate() method
should be allocator<U>::const_pointer, where U - any type. So since the
second parameter is not a template parameter, the only case is to be of
allocator<void>::const_pointer type. Or simple const void*.
I propose to remove workarounds for IBM Visual Age and Apache STL and
make const void* type for all implementations:
{{{
Index: libs/unordered/test/helpers/allocator.hpp
===================================================================
--- libs/unordered/test/helpers/allocator.hpp (revision 42908)
+++ libs/unordered/test/helpers/allocator.hpp (working copy)
@@ -45,13 +45,7 @@
return ptr;
}
- pointer allocate(size_type n, const_pointer u) { return
allocate(n); }
-
-#if defined(__IBMCPP__) || BOOST_WORKAROUND(BOOST_RWSTD_VER, <
0x04020000)
- // Workaround for IBM Visual Age and Rogue Wave (or maybe just
Apache stdcxx?)
- // which seem to use a void pointer for the second argument.
pointer allocate(size_type n, void const* u) { return
allocate(n); }
-#endif
void deallocate(pointer p, size_type) {
using namespace std;
}}}
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1596>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC