[Boost-bugs] [Boost C++ Libraries] #3610: boost::format copy constructor can create format object in unexpected state.

Subject: [Boost-bugs] [Boost C++ Libraries] #3610: boost::format copy constructor can create format object in unexpected state.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-11 16:18:03


#3610: boost::format copy constructor can create format object in unexpected
state.
---------------------------------------------------+------------------------
 Reporter: David Ward <davidjward30@…> | Owner: samuel_krempp
     Type: Bugs | Status: new
Milestone: Boost 1.41.0 | Component: format
  Version: Boost 1.37.0 | Severity: Problem
 Keywords: |
---------------------------------------------------+------------------------
 If I copy construct a new boost::format object, I expect it to be in a
 (re)useable state. However, the following code throws a
 boost::io::too_many_args exception

 {
         boost::format f("%d");

         std::cout << f % 10 << std::endl;
         std::cout << f % 10 << std::endl; // format object can be reused

         boost::format f2(f);
         std::cout << f2 % 10 << std::endl; // exception raised - new
 format is not in a valid state for formatting
 }


 On inspection of the code, the copy constructor always sets the dumped_
 member to false, yet it copies the cur_arg_ from the rhs object. It's hard
 to see how this behaviour might be desirable.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3610>
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:01 UTC