[Boost-bugs] [Boost C++ Libraries] #6026: phoenix block statement tries to copy objects instead of references

Subject: [Boost-bugs] [Boost C++ Libraries] #6026: phoenix block statement tries to copy objects instead of references
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-14 16:17:15


#6026: phoenix block statement tries to copy objects instead of references
--------------------------------+-------------------------------------------
 Reporter: armagvvg@… | Owner: theller
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: phoenix
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
--------------------------------+-------------------------------------------
 Let's use a simplest class, that can't be copied:

 {{{
 class A {
    A() {}
    A(const A&);
 public:
    static A* construct() { return new A(); }
    const A& operator<<(const char *p) const { return *this; }
 };

 A *pa = A::construct();
 A &a = *pa;

 }}}

 The code which use this object one time normally works:
 {{{
 (boost::phoenix::ref(a) << boost::phoenix::placeholders::_1)("aaa");
 }}}

 But when I try to use this object two times, I get an error:
 {{{
 (
    boost::phoenix::ref(a) << boost::phoenix::placeholders::_1
    ,boost::phoenix::ref(a) << boost::phoenix::placeholders::_1
 )("aaa");
 }}}

 Result: 'A::A' : cannot access private member declared in class 'A'

 Expecting: pass compilation and invoke "A::operator<<" two times.

 Note: preprocessing directive "BOOST_SPIRIT_USE_PHOENIX_V3" was defined.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6026>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC