Opened 12 years ago

Closed 12 years ago

#5232 closed Bugs (fixed)

ptr_container compiler error with BOOST_RESULT_OF_DECLTYPE

Reported by: Nathan Ridge <zeratul976@…> Owned by: Thorsten Ottosen
Milestone: To Be Determined Component: ptr_container
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

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-
    trunk/boost/preprocessor/iteration/detail/iter/forward1.hpp:52:0,
from ../../lib/boost-trunk/boost/utility/result_of.hpp:95,
from ../../lib/boost-trunk/boost/ptr_container/indirect_fun.hpp:23,
from ../../lib/boost-trunk/boost/ptr_container/ptr_set.hpp:19,
from test.cpp:1:
../../lib/boost-trunk/boost/utility/detail/result_of_iterate.hpp: In
    instantiation of 'boost::detail::cpp0x_result_of_impl<less<A>(A &)>':
../../lib/boost-trunk/boost/utility/detail/result_of_iterate.hpp:41:8:
    instantiated from 'boost::result_of<less<A>(A &)>'
../../lib/boost-trunk/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-trunk/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-trunk/boost/ptr_container/detail/reversible_ptr_container.hpp:110: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-trunk/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-trunk/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-trunk/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-trunk/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-trunk/boost/utility/detail/result_of_iterate.hpp:64:5: 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.

Change History (2)

comment:1 by anonymous, 12 years ago

I don't have access to a compiler with this feature yet. It would greatly help me if you could submit a patch.

kind regards

Thorsten

comment:2 by Thorsten Ottosen, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.