Opened 10 years ago

Closed 10 years ago

#8195 closed Bugs (fixed)

emplace method broken in boost heaps

Reported by: rob.patro@… Owned by: timblechmann
Milestone: To Be Determined Component: heap
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

The emplace operator does not correctly forward arguments to the type contained in the heap. I've attached a simple program that reproduces this bug. Compiling the attached program (on OSX 10.8.2 with gcc-4.7.2) produces the following error:

In file included from testpq.cpp:1:0:
/opt/local/include/boost/heap/skew_heap.hpp: In instantiation of 'boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::node_pointer boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::emplace_internal(Args&& ...) [with Args = {int, int}; T = thing; A0 = boost::heap::compare<cmpthings>; A1 = boost::parameter::void_; A2 = boost::parameter::void_; A3 = boost::parameter::void_; A4 = boost::parameter::void_; A5 = boost::parameter::void_; A6 = boost::parameter::void_; boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::node_pointer = boost::heap::detail::skew_heap_node<thing, false>*]':
/opt/local/include/boost/heap/skew_heap.hpp:769:13:   required from 'static void boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::push_void::emplace(boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>*, Args&& ...) [with Args = {int, int}; T = thing; A0 = boost::heap::compare<cmpthings>; A1 = boost::parameter::void_; A2 = boost::parameter::void_; A3 = boost::parameter::void_; A4 = boost::parameter::void_; A5 = boost::parameter::void_; A6 = boost::parameter::void_; boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6> = boost::heap::skew_heap<thing, boost::heap::compare<cmpthings> >]'
/opt/local/include/boost/heap/skew_heap.hpp:437:70:   required from 'typename boost::mpl::if_c<boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::is_mutable, typename boost::mpl::if_c<boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::is_mutable, typename boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::implementation_defined::handle_type, void*>::type, void>::type boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::emplace(Args&& ...) [with Args = {int, int}; T = thing; A0 = boost::heap::compare<cmpthings>; A1 = boost::parameter::void_; A2 = boost::parameter::void_; A3 = boost::parameter::void_; A4 = boost::parameter::void_; A5 = boost::parameter::void_; A6 = boost::parameter::void_; typename boost::mpl::if_c<boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::is_mutable, typename boost::mpl::if_c<boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::is_mutable, typename boost::heap::skew_heap<T, A0, A1, A2, A3, A4, A5, A6>::implementation_defined::handle_type, void*>::type, void>::type = void]'
testpq.cpp:27:20:   required from here
/opt/local/include/boost/heap/skew_heap.hpp:808:9: error: no matching function for call to 'boost::heap::skew_heap<thing, boost::heap::compare<cmpthings> >::make_node(int, int)'
/opt/local/include/boost/heap/skew_heap.hpp:808:9: note: candidates are:
In file included from /opt/local/include/boost/heap/skew_heap.hpp:21:0,
                 from testpq.cpp:1:
/opt/local/include/boost/heap/detail/stable_heap.hpp:189:19: note: boost::heap::detail::heap_base<T, Cmp, constant_time_size, StabilityCounterType, stable>::internal_type boost::heap::detail::heap_base<T, Cmp, constant_time_size, StabilityCounterType, stable>::make_node(const T&) [with T = thing; Cmp = cmpthings; bool constant_time_size = true; StabilityCounterType = long unsigned int; bool stable = false; boost::heap::detail::heap_base<T, Cmp, constant_time_size, StabilityCounterType, stable>::internal_type = thing]
/opt/local/include/boost/heap/detail/stable_heap.hpp:189:19: note:   candidate expects 1 argument, 2 provided
/opt/local/include/boost/heap/detail/stable_heap.hpp:195:10: note: T&& boost::heap::detail::heap_base<T, Cmp, constant_time_size, StabilityCounterType, stable>::make_node(T&&) [with T = thing; Cmp = cmpthings; bool constant_time_size = true; StabilityCounterType = long unsigned int; bool stable = false]
/opt/local/include/boost/heap/detail/stable_heap.hpp:195:10: note:   candidate expects 1 argument, 2 provided

Attachments (1)

testpq.cpp (533 bytes ) - added by rob.patro@… 10 years ago.
file reproduces bug with heap emplace operation.

Download all attachments as: .zip

Change History (2)

by rob.patro@…, 10 years ago

Attachment: testpq.cpp added

file reproduces bug with heap emplace operation.

comment:1 by timblechmann, 10 years ago

Resolution: fixed
Status: newclosed

(In [83263]) heap: fix emplace operations

fixes #8195

Note: See TracTickets for help on using tickets.