Boost C++ Libraries: Ticket #1846: boost::addressof() doesn't work with function references https://svn.boost.org/trac10/ticket/1846 <pre class="wiki">#include &lt;boost/utility/addressof.hpp&gt; void foo() {} int main() { boost::addressof(foo); // boom } </pre><p> This also affects reference_wrapper and any other utility that makes use of boost::addressof(). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1846 Trac 1.4.3 Peter Dimov Mon, 21 Apr 2008 18:25:11 GMT status changed https://svn.boost.org/trac10/ticket/1846#comment:1 https://svn.boost.org/trac10/ticket/1846#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Who volunteered me as a maintainer of addressof :-) </p> <p> The documentations for addressof and reference_wrapper both state that they work on objects, and functions are not objects. The latest working draft says so as well. </p> Ticket Eric Niebler Mon, 21 Apr 2008 18:54:13 GMT <link>https://svn.boost.org/trac10/ticket/1846#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1846#comment:2</guid> <description> <p> Yours is the last name in the comment block at the top of the file. Hence the honor. :-) </p> <p> Seems odd to restrict reference_wrapper and addressof to object types when the semantics for functions is perfectly reasonable and obvious. It certainly hurts generic code to have to test for function references before any call to boost::ref(). I actually had to work around this problem in my code. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Mon, 21 Apr 2008 20:29:43 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1846#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1846#comment:3</guid> <description> <p> Any ideas on how to fix this without bringing in type_traits? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Mon, 21 Apr 2008 21:42:30 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/1846#comment:4 https://svn.boost.org/trac10/ticket/1846#comment:4 <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/44705" title="Fix #1846.">[44705]</a>) Fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1846" title="#1846: Bugs: boost::addressof() doesn't work with function references (closed: fixed)">#1846</a>. </p> Ticket Eric Niebler Tue, 22 Apr 2008 20:29:29 GMT <link>https://svn.boost.org/trac10/ticket/1846#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1846#comment:5</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/44725" title="Merged revisions ...">[44725]</a>) Merged revisions 44678-44679,44681-44689,44691-44692,44694,44697-44699,44704-44707,44711,44715,44717-44719,44722 via svnmerge from <a class="ext-link" href="https://svn.boost.org/svn/boost/trunk"><span class="icon">​</span>https://svn.boost.org/svn/boost/trunk</a> </p> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44678" title="Add porthopper example to demonstrate applications that mix ...">r44678</a> | chris_kohlhoff | 2008-04-20 22:43:42 -0700 (Sun, 20 Apr 2008) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Add porthopper example to demonstrate applications that mix synchronous and asynchronous operations. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44679" title="Remove a local variable that was hiding the ec parameter and ...">r44679</a> | chris_kohlhoff | 2008-04-20 22:52:20 -0700 (Sun, 20 Apr 2008) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Remove a local variable that was hiding the ec parameter and preventing error codes from being correctly propagated. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1820" title="#1820: Bugs: win_iocp_socket_service::accept() doesn't update error_code (closed: fixed)">#1820</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44681" title="Ensure all non-friend related functions are included in the documentation. ">r44681</a> | chris_kohlhoff | 2008-04-20 23:14:29 -0700 (Sun, 20 Apr 2008) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Ensure all non-friend related functions are included in the documentation. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44682" title="Add UNIX domain sockets, POSIX stream-oriented descriptors and Windows ...">r44682</a> | chris_kohlhoff | 2008-04-20 23:15:17 -0700 (Sun, 20 Apr 2008) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Add UNIX domain sockets, POSIX stream-oriented descriptors and Windows stream-oriented handles to the reference documentation. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44683" title="Regenerate documentation. ">r44683</a> | chris_kohlhoff | 2008-04-20 23:15:50 -0700 (Sun, 20 Apr 2008) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Regenerate documentation. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44684" title="Add documentation on the limits of the number of buffers that may be ...">r44684</a> | chris_kohlhoff | 2008-04-20 23:20:32 -0700 (Sun, 20 Apr 2008) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Add documentation on the limits of the number of buffers that may be transferred in individual operations. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44685" title="Add requirements for handle and descriptor services. Add new classes ...">r44685</a> | chris_kohlhoff | 2008-04-21 00:59:21 -0700 (Mon, 21 Apr 2008) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Add requirements for handle and descriptor services. Add new classes to the quickref index page. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44686" title="Remove trailing comma at end of enumerator list (gcc 4.x -pedantic error) ">r44686</a> | jhunold | 2008-04-21 01:07:55 -0700 (Mon, 21 Apr 2008) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Remove trailing comma at end of enumerator list (gcc 4.x -pedantic error) </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44687" title="Oops fix typo.">r44687</a> | johnmaddock | 2008-04-21 01:46:18 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Oops fix typo. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44688" title="Fix msvc warnings using new warning suppression header.">r44688</a> | johnmaddock | 2008-04-21 01:47:04 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Fix msvc warnings using new warning suppression header. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44689" title="Added new macro BOOST_NO_TEMPLATED_IOSTREAMS in response to issue #1765.">r44689</a> | johnmaddock | 2008-04-21 02:19:30 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Added new macro BOOST_NO_TEMPLATED_IOSTREAMS in response to issue <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1765" title="#1765: Bugs: Need a macro to determine whether basic streams are present (closed: fixed)">#1765</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44691" title="removed act-as-jamfile, which gives errors when boost.use-project is ...">r44691</a> | speedsnail | 2008-04-21 04:46:03 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> removed act-as-jamfile, which gives errors when boost.use-project is not invoked from Jamroot file. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44692" title="Changed macro BOOST_PARTIAL_SPECIALIZATION_EXPLICIT_ARGS to ...">r44692</a> | johnmaddock | 2008-04-21 05:06:02 -0700 (Mon, 21 Apr 2008) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Changed macro BOOST_PARTIAL_SPECIALIZATION_EXPLICIT_ARGS to BOOST_NO_PARTIAL_SPECIALIZATION_DEFAULT_ARGS. Changed &lt;utility&gt; to &lt;boost/config/no_tr1/utility.hpp&gt; in order to prevent cyclic dependencies between Fusion Tuples and TR1. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44694" title="Merged changes from the Sandbox, and rebuilt the docs. Also added some ...">r44694</a> | johnmaddock | 2008-04-21 06:00:16 -0700 (Mon, 21 Apr 2008) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Merged changes from the Sandbox, and rebuilt the docs. Also added some missing files. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44697" title="Factor out the code for choosing the bucket count, and which bucket ...">r44697</a> | danieljames | 2008-04-21 08:55:40 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44698" title="added private copy assignment operator and copy constructor to remove ...">r44698</a> | anthonyw | 2008-04-21 09:20:31 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> added private copy assignment operator and copy constructor to remove warnings </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44699" title="Revamped condition variable to try and fix swallowed-notify problems ...">r44699</a> | anthonyw | 2008-04-21 09:22:16 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Revamped condition variable to try and fix swallowed-notify problems (trac issue <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1834" title="#1834: Bugs: boost::condition drops signals with notify_one() (closed: fixed)">#1834</a>) </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44704" title="Add ref_fn_test.cpp per #1846.">r44704</a> | pdimov | 2008-04-21 14:29:28 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Add ref_fn_test.cpp per <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1846" title="#1846: Bugs: boost::addressof() doesn't work with function references (closed: fixed)">#1846</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44705" title="Fix #1846.">r44705</a> | pdimov | 2008-04-21 14:42:29 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1846" title="#1846: Bugs: boost::addressof() doesn't work with function references (closed: fixed)">#1846</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44706" title="Fixed MSVC-specific compile errors when /Za command-line option is ...">r44706</a> | emildotchevski | 2008-04-21 15:42:54 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Fixed MSVC-specific compile errors when /Za command-line option is used, due to lack of throw() in std::~exception(). </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44707" title="Honor BOOST_NO_TEMPLATED_IOSTREAMS.">r44707</a> | pdimov | 2008-04-21 16:01:51 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Honor BOOST_NO_TEMPLATED_IOSTREAMS. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44711" title="Avoid unneccessary increment/decrement of reference count">r44711</a> | daniel_frey | 2008-04-21 23:31:32 -0700 (Mon, 21 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Avoid unneccessary increment/decrement of reference count </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44715" title="Added new files.">r44715</a> | johnmaddock | 2008-04-22 01:34:43 -0700 (Tue, 22 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Added new files. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44717" title="Resource-constrained shortest paths, from Michael Drexl">r44717</a> | dgregor | 2008-04-22 05:24:25 -0700 (Tue, 22 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Resource-constrained shortest paths, from Michael Drexl </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44718" title="Spirit: Started to add '#include &lt;boost/config/warning_disable.hpp&gt;' ...">r44718</a> | hkaiser | 2008-04-22 07:13:58 -0700 (Tue, 22 Apr 2008) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Spirit: Started to add '#include &lt;boost/config/warning_disable.hpp&gt;' to tests and examples. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44719" title="Spirit.Support: Minor change">r44719</a> | hkaiser | 2008-04-22 08:10:52 -0700 (Tue, 22 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Spirit.Support: Minor change </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/44722" title="Wave: fixed #1843">r44722</a> | hkaiser | 2008-04-22 10:23:21 -0700 (Tue, 22 Apr 2008) | 1 line </p> </blockquote> <p> </p> <blockquote> <p> Wave: fixed <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1843" title="#1843: Bugs: gcc-4.3: wave compile fix (closed: fixed)">#1843</a> </p> </blockquote> <p> ........ </p> </description> <category>Ticket</category> </item> </channel> </rss>