Boost C++ Libraries: Ticket #10401: phoenix::bind called with shared_ptr<T>::get as member function pointer does not compile with clang 3.5 https://svn.boost.org/trac10/ticket/10401 <p> The code to reproduce this issue is fairly simple: </p> <pre class="wiki">#include &lt;boost/phoenix.hpp&gt; #include &lt;boost/shared_ptr.hpp&gt; typedef boost::shared_ptr&lt;int&gt; sptr; int main() { boost::phoenix::bind(&amp;sptr::get, boost::phoenix::placeholders::arg1); } </pre><p> Here's what clang says: </p> <pre class="wiki">clang++-3.5 -O2 -I/home/A.Romanek/tmp/boost/boost_1_56_0 -c -o test.o test.cpp In file included from test.cpp:1: In file included from /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix.hpp:11: In file included from /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/phoenix.hpp:17: In file included from /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/bind.hpp:14: In file included from /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/bind/bind_member_variable.hpp:13: /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/bind/detail/member_variable.hpp:50:15: error: reference to function type 'int *() const' cannot have 'const' qualifier RT&amp; operator()(Class&amp; obj) const ^ /home/A.Romanek/tmp/boost/boost_1_56_0/boost/proto/domain.hpp:145:40: note: in instantiation of template class 'boost::phoenix::detail::member_variable&lt;int *() const, int *(boost::shared_ptr&lt;int&gt;::*)() const&gt;' requested here struct as_expr&lt;T, typename T::proto_is_expr_, proto::callable&gt; ^ /home/A.Romanek/tmp/boost/boost_1_56_0/boost/proto/make_expr.hpp:78:13: note: during template argument deduction for class template partial specialization 'as_expr&lt;type-parameter-0-0, typename type-parameter-0-0::proto_is_expr_, boost::proto::callable&gt;' [with T = boost::phoenix::detail::member_variable&lt;int *() const, int *(boost::shared_ptr&lt;int&gt;::*)() const&gt;] : Domain::template as_expr&lt;T&gt; ^ /home/A.Romanek/tmp/boost/boost_1_56_0/boost/proto/detail/preprocessed/make_expr_.hpp:68:48: note: in instantiation of template class 'boost::proto::detail::protoify&lt;boost::phoenix::detail::member_variable&lt;int *() const, int *(boost::shared_ptr&lt;int&gt;::*)() const&gt;, boost::proto::domainns_::basic_default_domain&gt;' requested here typename boost::proto::detail::protoify&lt; A0 , Domain &gt;::result_type , typename boost::proto::detail::protoify&lt; A1 , Domain &gt;::result_type ^ /home/A.Romanek/tmp/boost/boost_1_56_0/boost/proto/make_expr.hpp:180:34: note: in instantiation of template class 'boost::proto::detail::make_expr_&lt;boost::phoenix::detail::tag::function_eval, boost::proto::domainns_::basic_default_domain, boost::phoenix::detail::member_variable&lt;int *() const, int *(boost::shared_ptr&lt;int&gt;::*)() const&gt;, boost::phoenix::actor&lt;boost::proto::exprns_::basic_expr&lt;boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term&lt;boost::phoenix::argument&lt;1&gt; &gt;, 0&gt; &gt;, void, void, void, void, void, void, void, void, void&gt;' requested here typename detail::make_expr_&lt; ^ /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/core/preprocessed/expression_10.hpp:80:40: note: in instantiation of template class 'boost::proto::result_of::make_expr&lt;boost::phoenix::detail::tag::function_eval, boost::proto::domainns_::basic_default_domain, boost::phoenix::detail::member_variable&lt;int *() const, int *(boost::shared_ptr&lt;int&gt;::*)() const&gt;, boost::phoenix::actor&lt;boost::proto::exprns_::basic_expr&lt;boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term&lt;boost::phoenix::argument&lt;1&gt; &gt;, 0&gt; &gt;, void, void, void, void, void, void, void, void, void&gt;' requested here typename proto::result_of::make_expr&lt; ^ /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/core/preprocessed/expression_10.hpp:24:19: note: in instantiation of template class 'boost::phoenix::expr_ext&lt;actor, boost::phoenix::detail::tag::function_eval, boost::phoenix::detail::member_variable&lt;int *() const, int *(boost::shared_ptr&lt;int&gt;::*)() const&gt;, boost::phoenix::actor&lt;boost::proto::exprns_::basic_expr&lt;boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term&lt;boost::phoenix::argument&lt;1&gt; &gt;, 0&gt; &gt;, void, void, void, void, void, void, void, void, void&gt;' requested here struct expr : expr_ext&lt;actor, Tag, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9&gt; {}; ^ /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/core/detail/preprocessed/function_eval_10.hpp:7:588: note: in instantiation of template class 'boost::phoenix::expr&lt;boost::phoenix::detail::tag::function_eval, boost::phoenix::detail::member_variable&lt;int *() const, int *(boost::shared_ptr&lt;int&gt;::*)() const&gt;, boost::phoenix::actor&lt;boost::proto::exprns_::basic_expr&lt;boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term&lt;boost::phoenix::argument&lt;1&gt; &gt;, 0&gt; &gt;, void, void, void, void, void, void, void, void, void&gt;' requested here /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/bind/bind_member_variable.hpp:20:29: note: in instantiation of template class 'boost::phoenix::detail::expression::function_eval&lt;boost::phoenix::detail::member_variable&lt;int *() const, int *(boost::shared_ptr&lt;int&gt;::*)() const&gt;, boost::phoenix::actor&lt;boost::proto::exprns_::basic_expr&lt;boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term&lt;boost::phoenix::argument&lt;1&gt; &gt;, 0&gt; &gt;, void, void, void, void, void, void, void, void, void&gt;' requested here detail::expression::function_eval&lt; ^ test.cpp:7:3: note: while substituting deduced template arguments into function template 'bind' [with RT = int *() const, ClassT = boost::shared_ptr&lt;int&gt;, ClassA = boost::phoenix::actor&lt;boost::proto::exprns_::basic_expr&lt;boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term&lt;boost::phoenix::argument&lt;1&gt; &gt;, 0&gt; &gt;] boost::phoenix::bind(&amp;sptr::get, boost::phoenix::placeholders::arg1); ^ In file included from test.cpp:1: In file included from /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix.hpp:11: In file included from /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/phoenix.hpp:17: In file included from /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/bind.hpp:14: In file included from /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/bind/bind_member_variable.hpp:13: /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/bind/detail/member_variable.hpp:59:15: error: reference to function type 'int *() const' cannot have 'const' qualifier RT&amp; operator()(Class* obj) const ^ /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/bind/detail/member_variable.hpp:65:21: error: reference to function type 'int *() const' cannot have 'const' qualifier RT const&amp; operator()(Class const&amp; obj) const ^ /home/A.Romanek/tmp/boost/boost_1_56_0/boost/phoenix/bind/detail/member_variable.hpp:74:21: error: reference to function type 'int *() const' cannot have 'const' qualifier RT const&amp; operator()(Class const* obj) const ^ 4 errors generated. </pre><p> Clang version is: </p> <pre class="wiki">Ubuntu clang version 3.5.0-svn215833-1~exp1 (branches/release_35) (based on LLVM 3.5.0) Target: x86_64-pc-linux-gnu Thread model: posix </pre><p> It does not matter whether the code is compiled in C++03 or C++11 mode. The same example compiles without errors on gcc 4.8.2. </p> <p> Note that switching from Boost.Phoenix to Boost.Bind makes the code compile without a problem: </p> <pre class="wiki">#include &lt;boost/bind.hpp&gt; #include &lt;boost/shared_ptr.hpp&gt; typedef boost::shared_ptr&lt;int&gt; sptr; int main() { boost::bind(&amp;sptr::get, _1); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10401 Trac 1.4.3 John Fletcher <J.P.Fletcher@…> Sun, 12 Oct 2014 16:34:36 GMT <link>https://svn.boost.org/trac10/ticket/10401#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10401#comment:1</guid> <description> <p> I can confirm your problem with Clang 3.5 from the current distribution. It compiles O.K. with Clang 3.4. I am aware of a number of issues with Phoenix bind and this will be included in my investigation. John Fletcher. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Kohei Takahashi</dc:creator> <pubDate>Tue, 22 Nov 2016 17:52:00 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10401#comment:2 https://svn.boost.org/trac10/ticket/10401#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I'm not sure which commit actually fixed this issue, but 1.58 fixes this. </p> <p> <a class="ext-link" href="http://melpon.org/wandbox/permlink/KrXmp0k5gt9quaib"><span class="icon">​</span>http://melpon.org/wandbox/permlink/KrXmp0k5gt9quaib</a> </p> Ticket