Boost C++ Libraries: Ticket #3003: mem_fn does not work with CComPtr<T> in debug mode https://svn.boost.org/trac10/ticket/3003 <p> Short description: boost::mem_fn does not work with CComPtr&lt;T&gt; in debug mode, because it takes the address of CComPtr&lt;T&gt;, which asserts. </p> <p> See the thread on boost-users in which the problem was discussed: <a class="ext-link" href="http://groups.google.com/group/boost-list/browse_thread/thread/e74efb5329e47e4e/83663a064e8838cc#83663a064e8838cc"><span class="icon">​</span>http://groups.google.com/group/boost-list/browse_thread/thread/e74efb5329e47e4e/83663a064e8838cc#83663a064e8838cc</a>. </p> <p> To reproduce the problem without CComPtr: </p> <p> #include &lt;cstdlib&gt; #include &lt;boost/bind.hpp&gt; </p> <p> struct foo { </p> <blockquote> <p> void bar() {} </p> </blockquote> <p> } f; </p> <p> struct ptr { </p> <blockquote> <p> void* operator&amp;() { std::abort(); } </p> </blockquote> <p> }; </p> <p> foo* get_pointer(const ptr&amp; p) { return &amp;f; } </p> <p> int main() { </p> <blockquote> <p> boost::bind(&amp;foo::bar, ptr())(); </p> </blockquote> <p> } </p> <p> I attached a diff against trunk that fixes the problem in a backward compatible way. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3003 Trac 1.4.3 Roman Perepelitsa <roman.perepelitsa@…> Fri, 08 May 2009 12:03:03 GMT attachment set https://svn.boost.org/trac10/ticket/3003 https://svn.boost.org/trac10/ticket/3003 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">mem_fn_template.diff</span> </li> </ul> Ticket roman.perepelitsa@… Fri, 30 Oct 2009 15:15:46 GMT owner changed; cc set https://svn.boost.org/trac10/ticket/3003#comment:1 https://svn.boost.org/trac10/ticket/3003#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">roman.perepelitsa@…</span> added </li> <li><strong>owner</strong> changed from <span class="trac-author">Peter Dimov</span> to <span class="trac-author">Steven Watanabe</span> </li> </ul> <p> I initially assigned this to pdimov, but didn't receive any feedback in 6 months. Is it because someone else currently maintains bind? </p> <p> Steven, could you reassign to the appropriate person? </p> Ticket Steven Watanabe Sun, 01 Nov 2009 14:59:05 GMT owner changed https://svn.boost.org/trac10/ticket/3003#comment:2 https://svn.boost.org/trac10/ticket/3003#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Steven Watanabe</span> to <span class="trac-author">Peter Dimov</span> </li> </ul> Ticket Peter Dimov Tue, 01 Dec 2009 01:48:29 GMT milestone changed https://svn.boost.org/trac10/ticket/3003#comment:3 https://svn.boost.org/trac10/ticket/3003#comment:3 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.39.0</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> Ticket Peter Dimov Tue, 01 Dec 2009 02:24:54 GMT <link>https://svn.boost.org/trac10/ticket/3003#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3003#comment:4</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/58073" title="Make mem_fn work with overloaded unary operator&amp;. Refs #3003. Sorry it ...">[58073]</a>) Make mem_fn work with overloaded unary operator&amp;. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3003" title="#3003: Bugs: mem_fn does not work with CComPtr&lt;T&gt; in debug mode (closed: fixed)">#3003</a>. Sorry it took so long. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Tue, 01 Dec 2009 02:28:25 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/3003#comment:5 https://svn.boost.org/trac10/ticket/3003#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Peter Dimov Wed, 02 Dec 2009 10:47:02 GMT <link>https://svn.boost.org/trac10/ticket/3003#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3003#comment:6</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/58093" title="Fix Borland regression. Refs #3003.">[58093]</a>) Fix Borland regression. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3003" title="#3003: Bugs: mem_fn does not work with CComPtr&lt;T&gt; in debug mode (closed: fixed)">#3003</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Thu, 03 Dec 2009 17:44:39 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3003#comment:7 https://svn.boost.org/trac10/ticket/3003#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/58119" title="Merge [58073], [58093] to release. Fixes #3003.">[58119]</a>) Merge <a class="changeset" href="https://svn.boost.org/trac10/changeset/58073" title="Make mem_fn work with overloaded unary operator&amp;. Refs #3003. Sorry it ...">[58073]</a>, <a class="changeset" href="https://svn.boost.org/trac10/changeset/58093" title="Fix Borland regression. Refs #3003.">[58093]</a> to release. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3003" title="#3003: Bugs: mem_fn does not work with CComPtr&lt;T&gt; in debug mode (closed: fixed)">#3003</a>. </p> Ticket