The following code crashes under cygwin+boost1.33 and under mingw+boost1.33

I create text archive in a file, and then serialization crashes when restoring object from that archive.
The problem seem to be with bool field, if I replace
    bool x;
with
    int x;
in the class Obj implementation, everything runs fine.

Is this a bug in serialization code?

#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <map>
using namespace std;

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/map.hpp>

using namespace boost;
using namespace boost::serialization;

class Obj {
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        ar & x;
    }
public:
    bool x;
};

class Item;

class Cheq : public Obj{
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        ar & boost::serialization::base_object<Obj>(*this);
        ar & v;
        ar & id;
    }

public:
    vector<Item> v;
    int id;

    Cheq(){}
};

class Item{
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        ar & a;
        ar & s;
    }
public:
    int a;
    string s;
};

class Row{
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        ar & m1;
        ar & m2;
    }
public:
    map<string,string> m1,m2;
};

class Data{
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        ar & a;
        ar & m;
        ar & cheque;
    }

public:
    int a;
    map<string,string> m;
    map<int,Cheq> cheque;
};

BOOST_CLASS_TRACKING(Data, boost::serialization::track_never)

#include "boost/serialization/export.hpp"
BOOST_CLASS_EXPORT(Data);
BOOST_CLASS_EXPORT(Cheq);
BOOST_CLASS_EXPORT(Item);

int main(int argc, char** argv)
{
    Data d;
    d.cheque[0]=Cheq();

    //if(argc>1 && argv[1][0]=='1')
    {
        ofstream os("datfile");
        boost::archive::text_oarchive oar(os);
        oar << d;
    }

    //if(argc>1 && argv[1][0]=='2')
    {
        ifstream is("datfile");
        boost::archive::text_iarchive iar(is);
        iar >> d;
    }
    cout << "without crash\n";
    return 0;
}



--
WBR, Pavlo Korzhyk
ICQ#155870780