Boost C++ Libraries: Ticket #10864: Boost 1.57 + Xcode 6: function/lamba incompatibility https://svn.boost.org/trac10/ticket/10864 <p> Boost 1.57 and clang 6 (from Xcode 6) reject this program: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/lambda/lambda.hpp&gt; #include &lt;boost/function.hpp&gt; typedef boost::function&lt;void(std::ostream&amp;)&gt; Streamer; void out(const Streamer&amp; func) { func(std::cout); } int main(int argc, char *argv[]) { out(boost::lambda::_1 &lt;&lt; "hi there\n"); return 0; } </pre><p> Errors start with: </p> <pre class="wiki">boost/lambda/detail/lambda_traits.hpp:256:58: error: cannot form a reference to 'void' typename detail::IF&lt;boost::is_function&lt;T&gt;::value, T&amp;, const T&gt;::RET ^ </pre><p> This works with Boost 1.55 with clang 6. </p> <p> This works with Boost 1.57 with older compilers. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10864 Trac 1.4.3 nat@… Wed, 10 Dec 2014 19:03:24 GMT <link>https://svn.boost.org/trac10/ticket/10864#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10864#comment:1</guid> <description> <p> The following is a viable workaround: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/phoenix/core/argument.hpp&gt; #include &lt;boost/phoenix/operator/bitwise.hpp&gt; #include &lt;boost/function.hpp&gt; typedef boost::function&lt;void(std::ostream&amp;)&gt; Streamer; void out(const Streamer&amp; func) { func(std::cout); } int main(int argc, char *argv[]) { out(boost::phoenix::placeholders::arg1 &lt;&lt; "hi there\n"); return 0; } </pre> </description> <category>Ticket</category> </item> </channel> </rss>