Re: [Boost-bugs] [Boost C++ Libraries] #7474: compilation error in boost::serialization

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7474: compilation error in boost::serialization
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-22 20:30:28


#7474: compilation error in boost::serialization
--------------------------------------------+-------------------------------
  Reporter: Like Gao <gao.like@…> | Owner: ramey
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: serialization
   Version: Boost Release Branch | Severity: Problem
Resolution: | Keywords:
--------------------------------------------+-------------------------------
Changes (by Like Gao <gao.like@…>):

  * status: closed => reopened
  * resolution: invalid =>

Comment:

 Hi,
 I report this bug as it can be produced in below code --- where it doesn't
 matter if we use "const" Class in the client code or not.
 Thanks,
 -Like

 {{{

 //============================================================================
 // Name : boost_bug.cpp
 // Author :
 // Version :
 // Copyright : Your copyright notice
 //============================================================================

 #include <iostream>
 #include <tr1/memory>
 #include <fstream>
 #include <iostream>
 #include <iostream>
 #include <boost/archive/text_oarchive.hpp>


 class MyClassA
 {
 public:
         MyClassA(int x):xx(x){};
         int xx;
 private:

         friend class boost::serialization::access;

         template<class Archive>
         void save(Archive & ar, const unsigned int version) {
                 //ar << xx;
         }

         template<class Archive>
         void load(Archive & ar, const unsigned int version) {
                 //ar >> xx;
         }

         BOOST_SERIALIZATION_SPLIT_MEMBER();
 };




 int main() {
          MyClassA clsA(12);
         std::ofstream f("/tmp/boost_clsA", std::ios::binary);
         if (f.fail()) return -1;
         boost::archive::text_oarchive oa(f);
         oa << clsA;
         f.close();
         return 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7474#comment:2>
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:10 UTC