Boost logo

Boost Users :

Subject: [Boost-users] Boost Serialization now results in a compiler error - I have a fix, but I'm still unsure as to the cause
From: Lasse Laursen (gazoo_at_[hidden])
Date: 2013-05-10 03:32:15


Dear boosters,

I work with Cinder, creating an audio mixing app. Having recently
reached a milestone, I've upgraded from Vs2010 to Vs2012 as well as to
the latest Cinder (0.8.5) which also upgraded boost to 1.53.

While porting some code over that uses Serialization, I suddenly
provoked the following compiler error:

error C4308: negative integral constant converted to unsigned type

pointing me at the following code in in the boost print.hpp:

template <class T>
struct print
     : mpl::identity<T>
#if defined(__MWERKS__)
     , aux::print_base
#endif
{
#if defined(BOOST_MSVC)
     enum { n = sizeof(T) + -1 };
#elif defined(__MWERKS__)
     void f(int);
#else
     enum {
         n =
# if defined(__EDG_VERSION__)
            aux::dependent_unsigned<T>::value > -1
# else
            sizeof(T) > -1
# endif
         };
#endif
};

It's specifically the 'enum { n = sizeof(T) + -1 };' which triggers the
error. I simplified my code, and it seems to occur regardless of what I
do when I use the << operator to serialize the simple object I'm working
with.

Googling the issue turned up someone else in the same boat who received
the same message as a warning, rather than a distinct *error*. The
advice given was among other things to issue the following macro:

(http://lists.boost.org/boost-users/2010/05/59103.php)
BOOST_CLASS_TRACKING(mySimpleObject, boost::serialization::track_never)

My question is simply if someone else has experienced something similar
after upgrading to vs2012 or perhaps knows what is causing it?

Given that I've not touched my code, and it seems to me that simply
upgrading provoked this issue, I'm leaning towards assuming it's a
recent computability issue between boost and msvc?

Regards,
Gazoo


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