Hmmm - wouldn't this suggest an issue with BOOST_PP_CAT with msvc-8.0 ?
 
Robert Ramey
"Richard Turrin" <richt@OrbitFR.com> wrote in message news:51EB3AC91AAA7F40A782A8A51DD982A02152CFF5F0@mail.OrbitFR.com...

Hi,

 

I am in the midst of migrating some projects into VS 2008, and have downloaded and built the boost library from the SVN Trunk (retrieved on 18 December, 2007 @ 4:09 pm) which seems to satisfy support for VS 2008.  However, I was having a problem compiling some code that calls the macro BOOST_SHARED_POINTER_EXPORT (the code uses Boost serialization on some shared_ptr objects).  I was running into the following error:

 

MyOuterClass.h(11) : error C2371: '`anonymous-namespace'::boost_serialization_guid_initializer___LINE___1' : redefinition; different basic types

        MyOuterClass.h(10) : see declaration of '`anonymous-namespace'::boost_serialization_guid_initializer___LINE___1'

 

The issue seems to be located in the BOOST_CLASS_EXPORT_GUID_1 macro, line 160 in serialization/export.hpp.  The following macro is not expanding as desired:

 

#define BOOST_CLASS_EXPORT_GUID_1(T, K) \

...

    BOOST_PP_CAT(boost_serialization_guid_initializer_, __LINE__ ## _1)     \

 

I believe the author of this line intended that __LINE__ would be replaced with a line number where the macro is implicitly called from, and THEN concatenated with the _1 token.  Unfortunately, it seems that the two tokens are concatenated first creating __LINE___1 in the process.  I have a trivial workaround:

 

#define EXPAND(x) x

#define BOOST_CLASS_EXPORT_GUID_1(T, K) \

...

    BOOST_PP_CAT(boost_serialization_guid_initializer_, EXPAND(__LINE__) ## _1)     \

 

This allows me to compile without the error (under VS 2008).  Please advise if there is a better or more appropriate solution.  Also, I wasn’t sure whether _1 was a token literal or an mpl (Boost Metaprogramming library) placeholder.

 

I realize that 1.35 is not yet ready for release.  So, I’m not expecting everything to work correctly.  So far, this is the only issue I’ve run into.

 

Let me know if you need more information.  Thank you for your time!

 

Best Regards,

 

 

Rich Turrin


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users