|
Boost Users : |
Subject: [Boost-users] [TypeTraits] is_base_of behavior
From: Ioannis Papadopoulos (ipapadop_at_[hidden])
Date: 2009-07-02 18:45:08
Hi,
I'm getting different behaviours using is_base_of on different compilers
(tested with gcc, icc, xlc).
#include <boost/type_traits.hpp>
#include <boost/static_assert.hpp>
struct A { };
struct B : public A { };
int main() {
// Compile fine under all compilers
BOOST_STATIC_ASSERT( (boost::is_base_of<A,A>::value) );
// all fail in xlC 10.1, work fine in gcc 4.3-4.4 and icc 11
BOOST_STATIC_ASSERT( (boost::is_base_of<A,const A>::value) );
BOOST_STATIC_ASSERT( (boost::is_base_of<A,volatile A>::value) );
BOOST_STATIC_ASSERT( (boost::is_base_of<A,const volatile A>::value) );
// Compile fine under all compilers
BOOST_STATIC_ASSERT( (boost::is_base_of<A,B>::value) );
BOOST_STATIC_ASSERT( (boost::is_base_of<A,const B>::value) );
BOOST_STATIC_ASSERT( (boost::is_base_of<A,volatile B>::value) );
BOOST_STATIC_ASSERT( (boost::is_base_of<A,const volatile B>::value) );
return 0;
}
Thanks
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