Boost C++ Libraries: Ticket #3675: Boost.Parameter passing function pointers https://svn.boost.org/trac10/ticket/3675 <p> When passing function pointers with Boost.Parameter on Boost 1.41 on <a class="missing wiki">MacPorts</a>, there are errors. </p> <p> Apparently, somewhere the function type gets a "const" and that breaks stuff. </p> <p> That's the error message: </p> <pre class="wiki">bash-3.2$ make CXXFLAGS=-I/opt/local/include test g++ -I/opt/local/include test.cc -o test /opt/local/include/boost/parameter/aux_/arg_list.hpp: In constructor 'boost::parameter::aux::arg_list&lt;TaggedArg, Next&gt;::arg_list(A0&amp;, A1&amp;, A2&amp;, A3&amp;, A4&amp;) [with A0 = void ()(int)const, A1 = boost::parameter::void_, A2 = boost::parameter::void_, A3 = boost::parameter::void_, A4 = boost::parameter::void_, TaggedArg = boost::parameter::aux::tagged_argument&lt;tag::par, void ()(int)&gt;, Next = boost::parameter::aux::empty_arg_list]': /opt/local/include/boost/parameter/parameters.hpp:876: instantiated from 'typename boost::mpl::first&lt;typename boost::parameter::aux::make_arg_list&lt;boost::parameter::aux::item&lt;PS0, A0, boost::parameter::void_&gt;, typename boost::parameter::aux::make_deduced_items&lt;PS0, boost::parameter::aux::make_deduced_items&lt;PS1, boost::parameter::aux::make_deduced_items&lt;PS2, boost::parameter::aux::make_deduced_items&lt;PS3, boost::parameter::aux::make_deduced_items&lt;PS4, boost::mpl::identity&lt;boost::parameter::void_&gt; &gt; &gt; &gt; &gt; &gt;::type, boost::parameter::aux::tag_keyword_arg, mpl_::bool_&lt;true&gt; &gt;::type&gt;::type boost::parameter::parameters&lt;PS0, PS1, PS2, PS3, PS4&gt;::operator()(A0&amp;) const [with A0 = void ()(int)const, PS0 = boost::parameter::required&lt;tag::par, boost::mpl::always&lt;mpl_::true_&gt; &gt;, PS1 = boost::parameter::void_, PS2 = boost::parameter::void_, PS3 = boost::parameter::void_, PS4 = boost::parameter::void_]' test.cc:9: instantiated from 'typename boost_param_result_14testfn&lt;typename boost::parameter::aux::argument_pack&lt;boost_param_parameters_14testfn, const ParameterArgumentType0, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_&gt;::type&gt;::type testfn(const ParameterArgumentType0&amp;, typename boost::parameter::aux::match&lt;boost_param_parameters_14testfn, ParameterArgumentType0, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_&gt;::type) [with ParameterArgumentType0 = void ()(int)]' test.cc:20: instantiated from here /opt/local/include/boost/parameter/aux_/arg_list.hpp:208: error: no matching function for call to 'boost::parameter::aux::tagged_argument&lt;tag::par, void ()(int)&gt;::tagged_argument(void (&amp;)(int)const)' /opt/local/include/boost/parameter/aux_/tagged_argument.hpp:37: note: candidates are: boost::parameter::aux::tagged_argument&lt;KW, T&gt;::tagged_argument(Arg&amp;) [with Keyword = tag::par, Arg = void ()(int)] /opt/local/include/boost/parameter/aux_/tagged_argument.hpp:32: note: boost::parameter::aux::tagged_argument&lt;tag::par, void ()(int)&gt;::tagged_argument(const boost::parameter::aux::tagged_argument&lt;tag::par, void ()(int)&gt;&amp;) make: *** [test] Error 1 bash-3.2$ </pre><p> The example compiles on Linux just fine. I will attach the example if I find out how to do it. </p> <p> Please provide a workaround for the time until the fix for this hits the shelves. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3675 Trac 1.4.3 Aristid Breitkreuz <aristid.breitkreuz@…> Thu, 26 Nov 2009 16:11:05 GMT attachment set https://svn.boost.org/trac10/ticket/3675 https://svn.boost.org/trac10/ticket/3675 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-bug.cpp</span> </li> </ul> <p> Code that SHOULD work on all platforms, but doesn't </p> Ticket wes@… Thu, 26 Nov 2009 16:15:58 GMT <link>https://svn.boost.org/trac10/ticket/3675#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3675#comment:1</guid> <description> <p> System Info where bug was replicated: </p> <ul><li>Mac Ports 1.8.1 (latest) </li><li>Leopard, Intel iMac </li><li>i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) </li><li>Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 </li></ul> </description> <category>Ticket</category> </item> <item> <author>ash.berlin@…</author> <pubDate>Fri, 08 Jan 2010 14:02:55 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3675#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3675#comment:2</guid> <description> <p> The seems to be a bug of sorts in Apple's G++ 4.0.1. G++ 4.2.1 (which comes with xcode 3.1.3 and up) works. </p> <p> Also it works if you change: </p> <pre class="wiki"> std::cout &lt;&lt; (testfn(f) == f) &lt;&lt; std::endl; </pre><p> to use <code>&amp;f</code> instead of <code>f</code>: </p> <pre class="wiki"> std::cout &lt;&lt; (testfn(&amp;f) == f) &lt;&lt; std::endl; </pre><p> It compiles and prints <code>1</code> as expected. </p> </description> <category>Ticket</category> </item> </channel> </rss>