Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2004-11-04 03:41:31


In MSVC 6.0, the following snippet fails:

#include <boost/archive/text_iarchive.hpp>
#include <boost/tuple/tuple.hpp>

int main()
{
  return 0;
}

complaining about is_abstract being already defined. The problem
lies in the following lines inside boost/serialization/is_abstract.hpp:

#ifndef BOOST_TT_IS_ABSTRACT_CLASS_HPP
#if defined(__GNUC__) && (34 <= _GNUC__ * 10 + __GNU_MINOR) \
    || defined(__MSVC_VER) && (1310 <= __MSVC_VER) \
    || defined(__EDG_VERSION__) \
    /**/
    #include <boost/type_traits/is_abstract.hpp>
#else
// default to false if not supported
    namespace boost {
    template<class T>
    struct is_abstract {
        typedef mpl::bool_<false> type;
        BOOST_STATIC_CONSTANT(bool, value = is_abstract::type::value);
    };
    } // namespace boost
#endif
#endif // BOOST_TT_IS_ABSTRACT_CLASS_HPP

The code is *incorrectly* using __MSVC_VER where it should use
_MSVC_VER (just one leading underscore). Thus boost::is_abstract is
defined
twice, as boost/type_traits.hpp is implicitly included by
boost/tupe/tuple.hpp

If nobody complains, I can fix this and commit it to the release and
main branch.
What worries me, though, is that the code above seems flawed to me
(apart from the minor typo). What happens if the compiler is not one of
those
taken care of explicitly in boost/serialization/is_abstract.hpp? Could
anyone
please test the first snippet in some compiler other than MSVC, ICC for
Windows,
GCC or an EDG-based compiler? My thesis is that it will fail.

Thank you,

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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk