Boost C++ Libraries: Ticket #6026: phoenix block statement tries to copy objects instead of references https://svn.boost.org/trac10/ticket/6026 <p> Let's use a simplest class, that can't be copied: </p> <pre class="wiki">class A { A() {} A(const A&amp;); public: static A* construct() { return new A(); } const A&amp; operator&lt;&lt;(const char *p) const { return *this; } }; A *pa = A::construct(); A &amp;a = *pa; </pre><p> The code which use this object one time normally works: </p> <pre class="wiki">(boost::phoenix::ref(a) &lt;&lt; boost::phoenix::placeholders::_1)("aaa"); </pre><p> But when I try to use this object two times, I get an error: </p> <pre class="wiki">( boost::phoenix::ref(a) &lt;&lt; boost::phoenix::placeholders::_1 ,boost::phoenix::ref(a) &lt;&lt; boost::phoenix::placeholders::_1 )("aaa"); </pre><p> Result: 'A::A' : cannot access private member declared in class 'A' </p> <p> Expecting: pass compilation and invoke "A::operator&lt;&lt;" two times. </p> <p> Note: preprocessing directive "BOOST_SPIRIT_USE_PHOENIX_V3" was defined. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6026 Trac 1.4.3 Kohei Takahashi Mon, 09 May 2016 15:02:25 GMT owner, status changed https://svn.boost.org/trac10/ticket/6026#comment:1 https://svn.boost.org/trac10/ticket/6026#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Thomas Heller</span> to <span class="trac-author">Kohei Takahashi</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Confirmed in C++03 mode. <a class="ext-link" href="http://melpon.org/wandbox/permlink/UZtPeYVO11Ad3EG3"><span class="icon">​</span>http://melpon.org/wandbox/permlink/UZtPeYVO11Ad3EG3</a> </p> <p> In C++11, it works: <a class="ext-link" href="http://melpon.org/wandbox/permlink/x6k6rOMUbepDgkBh"><span class="icon">​</span>http://melpon.org/wandbox/permlink/x6k6rOMUbepDgkBh</a> </p> Ticket