Subject: [Boost-bugs] [Boost C++ Libraries] #3003: mem_fn does not work with CComPtr<T> in debug mode
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-05-08 12:01:43
#3003: mem_fn does not work with CComPtr<T> in debug mode
-------------------------------------------------------------+--------------
Reporter: Roman Perepelitsa <roman.perepelitsa_at_[hidden]> | Owner: pdimov
Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: bind
Version: Boost 1.38.0 | Severity: Problem
Keywords: |
-------------------------------------------------------------+--------------
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.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3003> 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:50:00 UTC