Fix is_virtual_base_of so it doesn't lose exception specifications on it's destructors (causes GCC and maybe other compilers to choke).

[SVN r55428]
This commit is contained in:
John Maddock
2009-08-06 08:54:45 +00:00
parent c9e77b9c8d
commit f1817aeee1
3 changed files with 23 additions and 4 deletions

View File

@ -42,14 +42,14 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
X();
X(const X&);
X& operator=(const X&);
~X();
~X()throw();
};
struct Y : public virtual Derived
{
Y();
Y(const Y&);
Y& operator=(const Y&);
~Y();
~Y()throw();
};
#else
struct X : Derived, virtual Base
@ -57,14 +57,14 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_>
X();
X(const X&);
X& operator=(const X&);
~X();
~X()throw();
};
struct Y : Derived
{
Y();
Y(const Y&);
Y& operator=(const Y&);
~Y();
~Y()throw();
};
#endif
BOOST_STATIC_CONSTANT(bool, value = (sizeof(X)==sizeof(Y)));

View File

@ -9,6 +9,21 @@
#include "check_integral_constant.hpp"
#include <boost/type_traits/is_virtual_base_of.hpp>
// for bug report 3317: https://svn.boost.org/trac/boost/ticket/3317
class B
{
public:
B();
virtual ~B()throw();
};
class D : public B
{
public:
D();
virtual ~D()throw();
};
TT_TEST_BEGIN(is_virtual_base_of)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<Derived,Base>::value), false);
@ -42,6 +57,9 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<boost::noncopyable,virtu
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<virtual_inherit4,boost::noncopyable>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<int_convertible,virtual_inherit5>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<virtual_inherit5,int_convertible>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<Base,virtual_inherit6>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<virtual_inherit6,Base>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<B,D>::value), false);
TT_TEST_END

View File

@ -370,6 +370,7 @@ struct virtual_inherit2 : virtual_inherit1 { };
struct virtual_inherit3 : private virtual Base {};
struct virtual_inherit4 : virtual boost::noncopyable {};
struct virtual_inherit5 : virtual int_convertible {};
struct virtual_inherit6 : virtual Base { virtual ~virtual_inherit6()throw(); };
typedef void foo0_t();
typedef void foo1_t(int);