Boost logo

Boost Users :

Subject: [Boost-users] [ptr_container] compiler error with BOOST_RESULT_OF_USE_DECLTYPE
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-02-25 02:30:10


Hello,
 
The following code:
 
#include <boost/ptr_container/ptr_set.hpp>
struct A
{
    bool operator<(const A&) const;
};
int main()
{
    boost::ptr_set<A> s;
    return 0;
}
 
gives the following compiler errors when compiling with BOOST_RESULT_OF_USE_DECLTYPE
defined:
 
In file included from ../../lib/boost-
    1.45/boost/preprocessor/iteration/detail/iter/forward1.hpp:52:0,
from ../../lib/boost-1.45/boost/utility/result_of.hpp:92,
from ../../lib/boost-1.45/boost/ptr_container/indirect_fun.hpp:23,
from ../../lib/boost-1.45/boost/ptr_container/ptr_set.hpp:19,
from test.cpp:1:
../../lib/boost-1.45/boost/utility/detail/result_of_iterate.hpp: In
    instantiation of 'boost::detail::cpp0x_result_of_impl<less<A>(A &)>':
../../lib/boost-1.45/boost/utility/detail/result_of_iterate.hpp:44:8:
    instantiated from 'boost::result_of<less<A>(A &)>'
../../lib/boost-1.45/boost/ptr_container/indirect_fun.hpp:107:9: instantiated
    from 'boost::void_ptr_indirect_fun<less<A>, A, A>'
stl_tree.h:462:31: instantiated from '_Rb_tree<
        void *, void *, _Identity<void *>
      , boost::void_ptr_indirect_fun<less<A>, A, A>
>'
stl_set.h:112:17: instantiated from 'set<
        void *, boost::void_ptr_indirect_fun<less<A>, A, A>
>'
../../lib/boost-1.45/boost/ptr_container/ptr_set_adapter.hpp:40:21:
    instantiated from 'boost::ptr_container_detail::set_config<
        A, set<void *, boost::void_ptr_indirect_fun<less<A>, A, A> >, true
>'
../../lib/boost-1.45/boost/ptr_container/detail/reversible_ptr_container.hpp:87:59:
    instantiated from 'boost::ptr_container_detail::reversible_ptr_container<
        boost::ptr_container_detail::set_config<
            A, set<void *, boost::void_ptr_indirect_fun<less<A>, A, A> >, true
>, boost::heap_clone_allocator
>'
../../lib/boost-1.45/boost/ptr_container/detail/associative_ptr_container.hpp:32:11:
    instantiated from 'boost::ptr_container_detail::associative_ptr_container<
        boost::ptr_container_detail::set_config<
            A, set<void *, boost::void_ptr_indirect_fun<less<A>, A, A> >, true
>, boost::heap_clone_allocator
>'
../../lib/boost-1.45/boost/ptr_container/ptr_set_adapter.hpp:122:11:
    instantiated from 'boost::ptr_container_detail::ptr_set_adapter_base<
        A, set<void *, boost::void_ptr_indirect_fun<less<A>, A, A> >
      , boost::heap_clone_allocator, true
>'
../../lib/boost-1.45/boost/ptr_container/ptr_set_adapter.hpp:299:11:
    instantiated from 'boost::ptr_set_adapter<
        A, set<void *, boost::void_ptr_indirect_fun<less<A>, A, A> >
      , boost::heap_clone_allocator, true
>'
../../lib/boost-1.45/boost/ptr_container/ptr_set.hpp:33:11: instantiated from
    'boost::ptr_set<A>'
../shared/test/test.cpp:10:23: instantiated from here
../../lib/boost-1.45/boost/utility/detail/result_of_iterate.hpp:70:69: error:
    no match for call to '(less<A>) (A &)'
stl_function.h:230:12: candidate is:
stl_function.h:233:7: bool less<A>::operator()(const A &, const A &) const
stl_function.h:233:7: candidate expects 2 arguments, 1 provided

 
I am compiling with g++ 4.5 with the --std=c++0x flag. The error goes away
if I do not define BOOST_RESULT_OF_USE_DECLTYPE (but I need this define
for other things).
 
Am I doing something wrong or is this a bug?
 
Thanks,
Nate.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net