Opened 13 years ago

Closed 13 years ago

#3003 closed Bugs (fixed)

mem_fn does not work with CComPtr<T> in debug mode

Reported by: Roman Perepelitsa <roman.perepelitsa@…> Owned by: Peter Dimov
Milestone: To Be Determined Component: bind
Version: Boost 1.38.0 Severity: Problem
Keywords: Cc: roman.perepelitsa@…

Description

Short description: boost::mem_fn does not work with CComPtr<T> in debug mode, because it takes the address of CComPtr<T>, which asserts.

See the thread on boost-users in which the problem was discussed: http://groups.google.com/group/boost-list/browse_thread/thread/e74efb5329e47e4e/83663a064e8838cc#83663a064e8838cc.

To reproduce the problem without CComPtr:

#include <cstdlib> #include <boost/bind.hpp>

struct foo {

void bar() {}

} f;

struct ptr {

void* operator&() { std::abort(); }

};

foo* get_pointer(const ptr& p) { return &f; }

int main() {

boost::bind(&foo::bar, ptr())();

}

I attached a diff against trunk that fixes the problem in a backward compatible way.

Attachments (1)

mem_fn_template.diff (7.6 KB ) - added by Roman Perepelitsa <roman.perepelitsa@…> 13 years ago.

Download all attachments as: .zip

Change History (8)

by Roman Perepelitsa <roman.perepelitsa@…>, 13 years ago

Attachment: mem_fn_template.diff added

comment:1 by roman.perepelitsa@…, 13 years ago

Cc: roman.perepelitsa@… added
Owner: changed from Peter Dimov to Steven Watanabe

I initially assigned this to pdimov, but didn't receive any feedback in 6 months. Is it because someone else currently maintains bind?

Steven, could you reassign to the appropriate person?

comment:2 by Steven Watanabe, 13 years ago

Owner: changed from Steven Watanabe to Peter Dimov

comment:3 by Peter Dimov, 13 years ago

Milestone: Boost 1.39.0To Be Determined

comment:4 by Peter Dimov, 13 years ago

(In [58073]) Make mem_fn work with overloaded unary operator&. Refs #3003. Sorry it took so long.

comment:5 by Peter Dimov, 13 years ago

Status: newassigned

comment:6 by Peter Dimov, 13 years ago

(In [58093]) Fix Borland regression. Refs #3003.

comment:7 by Peter Dimov, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [58119]) Merge [58073], [58093] to release. Fixes #3003.

Note: See TracTickets for help on using tickets.