Boost logo

Boost Users :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-09-15 11:02:11


The following test program:

#include <boost/archive/text_oarchive.hpp>
#include <sstream>

int main()
{
  int x=0;
  int* const px=&x;
  std::ostringstream oss;
  boost::archive::text_oarchive oa(oss);
  oa<<px;

  return 0;
}

produces this error in MSVC++ 6.0:

...boost/serialization/access.hpp(109) : error C2228: left of
'.serialize' must have
class/struct/union type
        ...boost/serialization/serialization.hpp(81) : see reference to
function template
        instantiation 'void __cdecl
boost::serialization::access::serialize(
         class boost::archive::text_oarchive &,int &,const unsigned
int)'
        being compiled

and the following error in GCC 3.2:

...boost/serialization/access.hpp: In static member
   function `static void
boost::serialization::access::serialize(Archive&, T&,
   unsigned int) [with Archive = boost::archive::text_oarchive, T =
int]':
...
...boost/serialization/access.hpp:109: request for member
   `serialize' in `t', which is of non-aggregate type `int'

I've checked the same snippet against Boost 1.33.1, CVS HEAD and
RC_1_34_0, using other primitive types like std::string, same problem
always. Same problem also for the loading counterpart. When the
pointed-to type is not primitive, though, everything works fine,
regardless
of whether the type has intrusive or non intrusive serialization
support.

I am sure I'm doing something really stupid here, but I've been banging
my head against this several hours. Some clue greatly appreciated.

Thank you,

Joaquín Mª López Muñoz
Telefónica, Investigación y Desarrollo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net