Merges changes from Trunk: refer to history.qbk for the details.

[SVN r65708]
This commit is contained in:
John Maddock committed 2010-10-01 11:11:16 +00:00
1 parent 58c6ce7362
commit 0977ea3b67
71 files changed
+2584 -170

No files matched your search

+14 -1
View File
@@ -8,7 +8,18 @@ import testing ;
# type_traits in V1 seem to have two modes: standalone, triggered
# by a command line option, and a regular. For now, just imitate
# regular
# regular
project : requirements
# default to all warnings on:
<warnings>all
# set warnings as errors for those compilers we know we get warning free:
<toolset>gcc:<cxxflags>-Wextra
<toolset>gcc:<warnings-as-errors>on
<toolset>intel:<warnings-as-errors>on
<toolset>sun:<warnings-as-errors>on
<toolset>msvc:<warnings-as-errors>on
;
rule all-tests {
local result ;
@@ -21,5 +32,7 @@ rule all-tests {
test-suite type_traits : [ all-tests ] ;
compile-fail common_type_fail.cpp ;
+63
View File
@@ -0,0 +1,63 @@
// (C) Copyright John Maddock 2000.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.tt.org/LICENSE_1_0.txt)
#include "test.hpp"
#include "check_type.hpp"
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/add_lvalue_reference.hpp>
#endif
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_1, ::tt::add_lvalue_reference, const, const&)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_2, ::tt::add_lvalue_reference, volatile, volatile&)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_3, ::tt::add_lvalue_reference, *, *&)
BOOST_DECL_TRANSFORM_TEST2(add_lvalue_reference_test_4, ::tt::add_lvalue_reference, &)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_5, ::tt::add_lvalue_reference, const &, const&)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_6, ::tt::add_lvalue_reference, &, &)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_7, ::tt::add_lvalue_reference, *volatile, *volatile&)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_8, ::tt::add_lvalue_reference, const [2], const (&)[2])
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_9, ::tt::add_lvalue_reference, const &, const&)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_10, ::tt::add_lvalue_reference, const*, const*&)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_11, ::tt::add_lvalue_reference, volatile*, volatile*&)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_12, ::tt::add_lvalue_reference, const[2][3], const (&)[2][3])
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_13, ::tt::add_lvalue_reference, (&)[2], (&)[2])
#ifndef BOOST_NO_RVALUE_REFERENCES
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_5a, ::tt::add_lvalue_reference, const &&, const&)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_6a, ::tt::add_lvalue_reference, &&, &)
BOOST_DECL_TRANSFORM_TEST(add_lvalue_reference_test_13a, ::tt::add_lvalue_reference, (&&)[2], (&)[2])
#endif
TT_TEST_BEGIN(add_lvalue_reference)
add_lvalue_reference_test_1();
add_lvalue_reference_test_2();
add_lvalue_reference_test_3();
add_lvalue_reference_test_4();
add_lvalue_reference_test_5();
add_lvalue_reference_test_6();
add_lvalue_reference_test_7();
add_lvalue_reference_test_8();
add_lvalue_reference_test_9();
add_lvalue_reference_test_10();
add_lvalue_reference_test_11();
add_lvalue_reference_test_12();
add_lvalue_reference_test_13();
#ifndef BOOST_NO_RVALUE_REFERENCES
add_lvalue_reference_test_5a();
add_lvalue_reference_test_6a();
add_lvalue_reference_test_13a();
#endif
TT_TEST_END
+80
View File
@@ -0,0 +1,80 @@
// Copyright 2010 Vicente J. Botet Escriba
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.tt.org/LICENSE_1_0.txt)
#include "../../type_traits/test/test.hpp"
#include "../../type_traits/test/check_type.hpp"
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/add_rvalue_reference.hpp>
#endif
#ifdef BOOST_NO_RVALUE_REFERENCES
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_1, ::tt::add_rvalue_reference, const, const)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_2, ::tt::add_rvalue_reference, volatile, volatile)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_3, ::tt::add_rvalue_reference, *, *)
BOOST_DECL_TRANSFORM_TEST0(add_rvalue_reference_test_4, ::tt::add_rvalue_reference)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_5, ::tt::add_rvalue_reference, const &, const&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_6, ::tt::add_rvalue_reference, &, &)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_7, ::tt::add_rvalue_reference, *volatile, *volatile)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_8, ::tt::add_rvalue_reference, const [2], const [2])
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_9, ::tt::add_rvalue_reference, const &, const&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_10, ::tt::add_rvalue_reference, const*, const*)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_11, ::tt::add_rvalue_reference, volatile*, volatile*)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_12, ::tt::add_rvalue_reference, const[2][3], const [2][3])
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_13, ::tt::add_rvalue_reference, (&)[2], (&)[2])
#else
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_1, ::tt::add_rvalue_reference, const, const&&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_2, ::tt::add_rvalue_reference, volatile, volatile&&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_3, ::tt::add_rvalue_reference, *, *&&)
BOOST_DECL_TRANSFORM_TEST2(add_rvalue_reference_test_4, ::tt::add_rvalue_reference, &&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_5, ::tt::add_rvalue_reference, const &, const&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_6, ::tt::add_rvalue_reference, &, &)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_7, ::tt::add_rvalue_reference, *volatile, *volatile&&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_8, ::tt::add_rvalue_reference, const [2], const (&&) [2])
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_9, ::tt::add_rvalue_reference, const &, const&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_10, ::tt::add_rvalue_reference, const*, const*&&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_11, ::tt::add_rvalue_reference, volatile*, volatile*&&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_12, ::tt::add_rvalue_reference, const[2][3], const (&&) [2][3])
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_13, ::tt::add_rvalue_reference, (&)[2], (&)[2])
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_5a, ::tt::add_rvalue_reference, const &&, const&&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_6a, ::tt::add_rvalue_reference, &&, &&)
BOOST_DECL_TRANSFORM_TEST(add_rvalue_reference_test_13a, ::tt::add_rvalue_reference, (&&)[2], (&&)[2])
#endif
TT_TEST_BEGIN(add_rvalue_reference)
add_rvalue_reference_test_1();
add_rvalue_reference_test_2();
add_rvalue_reference_test_3();
add_rvalue_reference_test_4();
add_rvalue_reference_test_5();
add_rvalue_reference_test_6();
add_rvalue_reference_test_7();
add_rvalue_reference_test_8();
add_rvalue_reference_test_9();
add_rvalue_reference_test_10();
add_rvalue_reference_test_11();
add_rvalue_reference_test_12();
add_rvalue_reference_test_13();
#ifndef BOOST_NO_RVALUE_REFERENCES
add_rvalue_reference_test_5a();
add_rvalue_reference_test_6a();
add_rvalue_reference_test_13a();
#endif
TT_TEST_END
+1 -1
View File
@@ -102,7 +102,7 @@ do_check<long double>();
do_check<__int64>();
#endif
#ifdef BOOST_HAS_LONG_LONG
do_check<long long>();
do_check<boost::long_long_type>();
#endif
do_check<int(*)(int)>();
+5 -1
View File
@@ -27,6 +27,10 @@ inline void no_unused_warning(const volatile T&)
{
}
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(BOOST_INTEL)
#pragma GCC diagnostic ignored "-Wmissing-braces"
#endif
template <class T>
void do_check(const T&)
{
@@ -55,7 +59,7 @@ void do_check(const T&)
#ifndef TEST_STD
// Non-Tr1 behaviour:
typedef typename tt::aligned_storage<T::value,-1L>::type t3;
typedef typename tt::aligned_storage<T::value, ~static_cast<std::size_t>(0UL)>::type t3;
t3 as3 = { 0, };
must_be_pod<t3> pod3;
no_unused_warning(as3);
@@ -16,10 +16,23 @@
# include <boost/type_traits/alignment_of.hpp>
#endif
//
// Need to defined some member functions for empty_UDT,
// we don't want to put these in the test.hpp as that
// causes overly-clever compilers to figure out that they can't throw
// which in turn breaks other tests.
//
empty_UDT::empty_UDT(){}
empty_UDT::~empty_UDT(){}
empty_UDT::empty_UDT(const empty_UDT&){}
empty_UDT& empty_UDT::operator=(const empty_UDT&){ return *this; }
bool empty_UDT::operator==(const empty_UDT&)const{ return true; }
//
// VC++ emits an awful lot of warnings unless we define these:
#ifdef BOOST_MSVC
# pragma warning(disable:4244)
# pragma warning(disable:4244 4121)
//
// What follows here is the test case for issue 1946.
//
+12
View File
@@ -12,6 +12,18 @@
# include <boost/type_traits/alignment_of.hpp>
#endif
//
// Need to defined some member function for empty_UDT,
// we don't want to put these in the test.hpp as that
// causes overly-clever compilers to figure out that they can't throw
// which in turn breaks other tests.
//
empty_UDT::empty_UDT(){}
empty_UDT::~empty_UDT(){}
empty_UDT::empty_UDT(const empty_UDT&){}
empty_UDT& empty_UDT::operator=(const empty_UDT&){ return *this; }
bool empty_UDT::operator==(const empty_UDT&)const{ return true; }
//
// VC++ emits an awful lot of warnings unless we define these:
#ifdef BOOST_MSVC
+28
View File
@@ -0,0 +1,28 @@
// common_type_test.cpp ----------------------------------------------------//
// Copyright 2010 Beman Dawes
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#define _CRT_SECURE_NO_WARNINGS // disable VC++ foolishness
#include "test.hpp"
#ifndef TEST_STD
#include <boost/type_traits/common_type.hpp>
#else
#include <type_traits>
#endif
struct C1 {
//~ private:
//~ C1();
};
struct C2 {};
typedef tt::common_type<C1, C2>::type AC;
+107
View File
@@ -0,0 +1,107 @@
// common_type_test.cpp ----------------------------------------------------//
// Copyright 2010 Beman Dawes
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#include "test.hpp"
#include "check_type.hpp"
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/common_type.hpp>
#endif
#include <iostream>
#ifdef BOOST_INTEL
#pragma warning(disable: 304 383)
#endif
struct C1 {};
struct C2 {};
struct C3 : C2 {};
struct C1C2 {
C1C2() {}
C1C2(C1 const&) {}
C1C2(C2 const&) {}
C1C2& operator=(C1C2 const&) {
return *this;
}
};
template <typename C, typename A>
void proc2(typename boost::common_type<A, C>::type const& ) {}
template <typename C, typename A, typename B>
void proc3(typename boost::common_type<C, A, B>::type const& ) {}
template <typename C, typename A>
void assignation_2() {
typedef typename boost::common_type<A, C>::type AC;
A a;
C c;
AC ac;
ac=a;
ac=c;
proc2<C, A>(a);
proc2<C, A>(c);
}
template <typename C, typename A, typename B>
void assignation_3() {
typedef typename boost::common_type<C, A, B>::type ABC;
A a;
B b;
C c;
ABC abc;
abc=a;
abc=b;
abc=c;
proc3<C, A, B>(a);
proc3<C, A, B>(b);
proc3<C, A, B>(c);
}
C1C2 c1c2;
C1 c1;
int f(C1C2 ) { return 1;}
int f(C1 ) { return 2;}
template <typename OSTREAM>
OSTREAM& operator<<(OSTREAM& os, C1 const&) {return os;}
C1C2& declval_C1C2() {return c1c2;}
C1& declval_C1(){return c1;}
bool declval_bool(){return true;}
TT_TEST_BEGIN(common_type)
{
assignation_2<C1C2, C1>();
typedef tt::common_type<C1C2&, C1&>::type T1;
typedef tt::common_type<C3*, C2*>::type T2;
typedef tt::common_type<int*, int const*>::type T3;
#if defined(BOOST_NO_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF)
// fails if BOOST_COMMON_TYPE_DONT_USE_TYPEOF:
typedef tt::common_type<int volatile*, int const*>::type T4;
#endif
typedef tt::common_type<int*, int volatile*>::type T5;
assignation_2<C1, C1C2>();
assignation_2<C1C2, C2>();
assignation_2<C2, C1C2>();
assignation_3<C1, C1C2, C2>();
assignation_3<C1C2, C1, C2>();
assignation_3<C2, C1C2, C1>();
assignation_3<C1C2, C2, C1>();
//assignation_3<C1, C2, C1C2>(); // fails because the common type is the third
}
TT_TEST_END
+31
View File
@@ -0,0 +1,31 @@
// (C) Copyright John Maddock 2010.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
#include "check_integral_constant.hpp"
#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/conditional.hpp>
#endif
#include <boost/type_traits/is_same.hpp>
TT_TEST_BEGIN(conditional)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same< ::tt::conditional<true, int, long>::type, int>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same< ::tt::conditional<false, int, long>::type, long>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same< ::tt::conditional<true, int, long>::type, long>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_same< ::tt::conditional<false, int, long>::type, int>::value), false);
TT_TEST_END
+7
View File
@@ -16,6 +16,13 @@
#include <string>
#include <utility>
#ifdef BOOST_INTEL
// remark #383: value copied to temporary, reference to temporary used
// std::pair<std::string, int> p2 = boost::make_pair( "foo", 1 );
// ^
#pragma warning(disable:383)
#endif
namespace boost
{
+7
View File
@@ -7,6 +7,13 @@
#include "check_integral_constant.hpp"
#include <boost/type_traits/has_new_operator.hpp>
#ifdef BOOST_INTEL
// remark #1720: function "class_with_new_op::operator new" has no corresponding member operator delete (to be called if an exception is thrown during initialization of an allocated object)
// void * operator new(std::size_t);
// ^
#pragma warning(disable:1720)
#endif
struct class_with_new_op {
void * operator new(std::size_t);
};
+48 -48
View File
@@ -21,71 +21,71 @@
struct TestA {};
struct TestB { virtual void foo(void) = 0; };
struct TestC { private: virtual void foo(void) = 0; };
struct TestD : TestA {};
struct TestE : TestB {};
struct TestF : TestC {};
struct TestG : TestB { virtual void foo(void) {} };
struct TestH : TestC { private: virtual void foo(void) {} };
struct TestI : TestB, TestC {};
struct TestJ : TestI { virtual void foo(void) {} };
struct TestK : TestB { virtual void foo(void); virtual void foo2(void) = 0; };
struct TestL : TestK { virtual void foo2(void) {} };
struct TestM : virtual TestB {};
struct TestN : virtual TestC {};
struct TestO : TestM, TestN {};
struct TestP : TestO { virtual void foo(void) {} };
struct TestQ : TestB { virtual void foo(void) = 0; };
struct TestR : TestC { private: virtual void foo(void) = 0; };
struct TestD : public TestA {};
struct TestE : public TestB {};
struct TestF : public TestC {};
struct TestG : public TestB { virtual void foo(void) {} };
struct TestH : public TestC { private: virtual void foo(void) {} };
struct TestI : public TestB, public TestC {};
struct TestJ : public TestI { virtual void foo(void) {} };
struct TestK : public TestB { virtual void foo(void); virtual void foo2(void) = 0; };
struct TestL : public TestK { virtual void foo2(void) {} };
struct TestM : public virtual TestB {};
struct TestN : public virtual TestC {};
struct TestO : public TestM, public TestN {};
struct TestP : public TestO { virtual void foo(void) {} };
struct TestQ : public TestB { virtual void foo(void) = 0; };
struct TestR : public TestC { private: virtual void foo(void) = 0; };
struct TestS { virtual void foo(void) {} };
struct TestT { virtual ~TestT(void) {} virtual void foo(void) {} };
struct TestU : TestT { virtual void foo(void) = 0; };
struct TestV : TestT { virtual void foo(void) {} };
struct TestU : public TestT { virtual void foo(void) = 0; };
struct TestV : public TestT { virtual void foo(void) {} };
struct TestW { virtual void foo1(void) = 0; virtual void foo2(void) = 0; };
struct TestX : TestW { virtual void foo1(void) {} virtual void foo2(void) {} };
struct TestX : public TestW { virtual void foo1(void) {} virtual void foo2(void) {} };
struct TestY { virtual ~TestY(void) = 0; };
struct TestZ { virtual ~TestZ(void) = 0; }; TestZ::~TestZ(void) {}
struct TestAA : TestZ { virtual ~TestAA(void) = 0; }; TestAA::~TestAA(void) {}
struct TestAB : TestAA { virtual ~TestAB(void) {} };
struct TestAA : public TestZ { virtual ~TestAA(void) = 0; }; TestAA::~TestAA(void) {}
struct TestAB : public TestAA { virtual ~TestAB(void) {} };
struct TestAC { virtual void foo(void) = 0; }; void TestAC::foo(void) {}
struct TestAD : TestAC {};
struct TestAE : TestAD { virtual void foo() {} };
struct TestAF : TestAD { virtual void foo(); }; void TestAF::foo(void) {}
struct TestAG : virtual TestA {};
struct TestAD : public TestAC {};
struct TestAE : public TestAD { virtual void foo() {} };
struct TestAF : public TestAD { virtual void foo(); }; void TestAF::foo(void) {}
struct TestAG : public virtual TestA {};
// template test types:
template <class T> struct TTestA {};
template <class T> struct TTestB { virtual void foo(void) = 0; };
template <class T> struct TTestC { private: virtual void foo(void) = 0; };
template <class T> struct TTestD : TTestA<T> {};
template <class T> struct TTestE : TTestB<T> {};
template <class T> struct TTestF : TTestC<T> {};
template <class T> struct TTestG : TTestB<T> { virtual void foo(void) {} };
template <class T> struct TTestH : TTestC<T> { private: virtual void foo(void) {} };
template <class T> struct TTestI : TTestB<T>, TTestC<T> {};
template <class T> struct TTestJ : TTestI<T> { virtual void foo(void) {} };
template <class T> struct TTestK : TTestB<T> { virtual void foo(void); virtual void foo2(void) = 0; };
template <class T> struct TTestL : TTestK<T> { virtual void foo2(void) {} };
template <class T> struct TTestM : virtual TTestB<T> {};
template <class T> struct TTestN : virtual TTestC<T> {};
template <class T> struct TTestO : TTestM<T>, TTestN<T> {};
template <class T> struct TTestP : TTestO<T> { virtual void foo(void) {} };
template <class T> struct TTestQ : TTestB<T> { virtual void foo(void) = 0; };
template <class T> struct TTestR : TTestC<T> { private: virtual void foo(void) = 0; };
template <class T> struct TTestD : public TTestA<T> {};
template <class T> struct TTestE : public TTestB<T> {};
template <class T> struct TTestF : public TTestC<T> {};
template <class T> struct TTestG : public TTestB<T> { virtual void foo(void) {} };
template <class T> struct TTestH : public TTestC<T> { private: virtual void foo(void) {} };
template <class T> struct TTestI : public TTestB<T>, public TTestC<T> {};
template <class T> struct TTestJ : public TTestI<T> { virtual void foo(void) {} };
template <class T> struct TTestK : public TTestB<T> { virtual void foo(void); virtual void foo2(void) = 0; };
template <class T> struct TTestL : public TTestK<T> { virtual void foo2(void) {} };
template <class T> struct TTestM : public virtual TTestB<T> {};
template <class T> struct TTestN : public virtual TTestC<T> {};
template <class T> struct TTestO : public TTestM<T>, public TTestN<T> {};
template <class T> struct TTestP : public TTestO<T> { virtual void foo(void) {} };
template <class T> struct TTestQ : public TTestB<T> { virtual void foo(void) = 0; };
template <class T> struct TTestR : public TTestC<T> { private: virtual void foo(void) = 0; };
template <class T> struct TTestS { virtual void foo(void) {} };
template <class T> struct TTestT { virtual ~TTestT(void) {} virtual void foo(void) {} };
template <class T> struct TTestU : TTestT<T> { virtual void foo(void) = 0; };
template <class T> struct TTestV : TTestT<T> { virtual void foo(void) {} };
template <class T> struct TTestU : public TTestT<T> { virtual void foo(void) = 0; };
template <class T> struct TTestV : public TTestT<T> { virtual void foo(void) {} };
template <class T> struct TTestW { virtual void foo1(void) = 0; virtual void foo2(void) = 0; };
template <class T> struct TTestX : TTestW<T> { virtual void foo1(void) {} virtual void foo2(void) {} };
template <class T> struct TTestX : public TTestW<T> { virtual void foo1(void) {} virtual void foo2(void) {} };
template <class T> struct TTestY { virtual ~TTestY(void) = 0; };
template <class T> struct TTestZ { virtual ~TTestZ(void) = 0; }; template <class T> TTestZ<T>::~TTestZ(void) {}
template <class T> struct TTestAA : TTestZ<T> { virtual ~TTestAA(void) = 0; }; template <class T> TTestAA<T>::~TTestAA(void) {}
template <class T> struct TTestAB : TTestAA<T> { virtual ~TTestAB(void) {} };
template <class T> struct TTestAA : public TTestZ<T> { virtual ~TTestAA(void) = 0; }; template <class T> TTestAA<T>::~TTestAA(void) {}
template <class T> struct TTestAB : public TTestAA<T> { virtual ~TTestAB(void) {} };
template <class T> struct TTestAC { virtual void foo(void) = 0; }; template <class T> void TTestAC<T>::foo(void) {}
template <class T> struct TTestAD : TTestAC<T> {};
template <class T> struct TTestAE : TTestAD<T> { virtual void foo() {} };
template <class T> struct TTestAF : TTestAD<T> { virtual void foo(); }; template <class T> void TTestAF<T>::foo(void) {}
template <class T> struct TTestAG : virtual TTestA<T> {};
template <class T> struct TTestAD : public TTestAC<T> {};
template <class T> struct TTestAE : public TTestAD<T> { virtual void foo() {} };
template <class T> struct TTestAF : public TTestAD<T> { virtual void foo(); }; template <class T> void TTestAF<T>::foo(void) {}
template <class T> struct TTestAG : public virtual TTestA<T> {};
TT_TEST_BEGIN(is_abstract)
+5 -2
View File
@@ -19,8 +19,8 @@ struct convertible_from
};
struct base2 { };
struct middle2 : virtual base2 { };
struct derived2 : middle2 { };
struct middle2 : public virtual base2 { };
struct derived2 : public middle2 { };
TT_TEST_BEGIN(is_convertible)
@@ -104,8 +104,11 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<float
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<float const&> >::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<float&> >::value), true);
#if !(defined(__GNUC__) && (__GNUC__ < 4))
// GCC 3.x emits warnings here, which causes the tests to fail when we compile with warnings-as-errors:
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<char> >::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<char const&> >::value), true);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<char&> >::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<char,convertible_from<char> >::value), true);
+3
View File
@@ -30,7 +30,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<foo0_t>::value, f
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<const int[2] >::value, false);
#ifndef __IBMCPP__
// this test may not be strictly legal:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<const int[] >::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<void>::value, false);
#ifdef BOOST_TT_TEST_MS_FUNC_SIGS
+15
View File
@@ -24,6 +24,20 @@ public:
virtual ~D()throw();
};
// for bug report 4453: https://svn.boost.org/trac/boost/ticket/4453
class non_virtual_base
{
public:
non_virtual_base();
};
class non_virtual_derived : public non_virtual_base
{
public:
non_virtual_derived();
virtual int Y();
virtual int X();
};
TT_TEST_BEGIN(is_virtual_base_of)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<Derived,Base>::value), false);
@@ -60,6 +74,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<virtual_inherit5,int_con
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);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<non_virtual_base,non_virtual_derived>::value), false);
TT_TEST_END
+5
View File
@@ -17,6 +17,11 @@
#include "promote_util.hpp"
#ifdef BOOST_INTEL
// remark #1418: external function definition with no prior declaration
#pragma warning(disable:1418)
#endif
enum UIntEnum { UIntEnum_max = UINT_MAX };
Executable → Regular
+5
View File
@@ -31,6 +31,11 @@
#include "promote_util.hpp"
#include <boost/detail/workaround.hpp>
#ifdef BOOST_INTEL
// remark #1418: external function definition with no prior declaration
#pragma warning(disable:1418)
#endif
enum IntEnum1 { IntEnum1_min = -5 , IntEnum1_max = 5 };
enum IntEnum2 { IntEnum2_min = SHRT_MIN, IntEnum2_max = SHRT_MAX };
enum IntEnum3 { IntEnum3_min = INT_MIN , IntEnum3_max = INT_MAX };
+30 -17
View File
@@ -23,6 +23,17 @@
// We have to turn off warnings that occur within the test suite:
#pragma warning(disable:4127)
#endif
#ifdef BOOST_INTEL
// remark #1418: external function definition with no prior declaration
// remark #981: operands are evaluated in unspecified order
#pragma warning(disable:1418 981)
#endif
#ifdef BOOST_INTEL
// turn off warnings from this header:
#pragma warning(push)
#pragma warning(disable:444)
#endif
//
// basic configuration:
@@ -156,8 +167,8 @@ void name(){ TRANSFORM_CHECK(type, BOOST_DUMMY_MACRO_PARAM, BOOST_DUMMY_MACRO_PA
enum enum_UDT{ one, two, three };
struct UDT
{
UDT(){};
~UDT(){};
UDT();
~UDT();
UDT(const UDT&);
UDT& operator=(const UDT&);
int i;
@@ -206,12 +217,11 @@ typedef const r_type cr_type;
struct POD_UDT { int x; };
struct empty_UDT
{
empty_UDT(){};
empty_UDT(const empty_UDT&){};
~empty_UDT(){};
empty_UDT& operator=(const empty_UDT&){ return *this; }
bool operator==(const empty_UDT&)const
{ return true; }
empty_UDT();
empty_UDT(const empty_UDT&);
~empty_UDT();
empty_UDT& operator=(const empty_UDT&);
bool operator==(const empty_UDT&)const;
};
struct empty_POD_UDT
{
@@ -240,7 +250,7 @@ struct nothrow_copy_UDT
nothrow_copy_UDT();
nothrow_copy_UDT(const nothrow_copy_UDT&)throw();
~nothrow_copy_UDT(){};
nothrow_copy_UDT& operator=(const nothrow_copy_UDT&){ return *this; }
nothrow_copy_UDT& operator=(const nothrow_copy_UDT&);
bool operator==(const nothrow_copy_UDT&)const
{ return true; }
};
@@ -289,7 +299,7 @@ struct VB
virtual ~VB(){};
};
struct VD : VB
struct VD : public VB
{
~VD(){};
};
@@ -356,21 +366,21 @@ struct polymorphic_base
virtual void method();
};
struct polymorphic_derived1 : polymorphic_base
struct polymorphic_derived1 : public polymorphic_base
{
};
struct polymorphic_derived2 : polymorphic_base
struct polymorphic_derived2 : public polymorphic_base
{
virtual void method();
};
struct virtual_inherit1 : virtual Base { };
struct virtual_inherit2 : virtual_inherit1 { };
struct virtual_inherit1 : public virtual Base { };
struct virtual_inherit2 : public 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(); };
struct virtual_inherit4 : public virtual boost::noncopyable {};
struct virtual_inherit5 : public virtual int_convertible {};
struct virtual_inherit6 : public virtual Base { virtual ~virtual_inherit6()throw(); };
typedef void foo0_t();
typedef void foo1_t(int);
@@ -413,6 +423,9 @@ protected:
wrap& operator=(const wrap&);
};
#ifdef BOOST_INTEL
#pragma warning(pop)
#endif
#endif
+103
View File
@@ -0,0 +1,103 @@
// (C) Copyright John Maddock 2010.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/type_traits.hpp>
//
// Just check that each trait actually exists, not
// that it gives the correct answer, we do that elsewhere:
//
typedef boost::add_const<int>::type t1;
typedef boost::add_cv<int>::type t2;
typedef boost::add_lvalue_reference<int>::type t3;
typedef boost::add_pointer<int>::type t4;
typedef boost::add_reference<int>::type t5;
typedef boost::add_rvalue_reference<int>::type t6;
typedef boost::add_volatile<int>::type t7;
typedef boost::aligned_storage<2>::type t8;
typedef boost::alignment_of<int>::type t9;
typedef boost::conditional<true, int, long>::type t10;
typedef boost::common_type<int, long>::type t11;
typedef boost::decay<int[2] >::type t12;
typedef boost::extent<int[3] >::type t13;
typedef boost::floating_point_promotion<int>::type t14;
typedef boost::function_traits<int (int) > t15;
typedef boost::has_new_operator<int> t16;
typedef boost::has_nothrow_assign<int> t17;
typedef boost::has_nothrow_constructor<int> t18;
typedef boost::has_nothrow_copy<int> t19;
typedef boost::has_nothrow_copy_constructor<int> t20;
typedef boost::has_nothrow_default_constructor<int> t21;
typedef boost::has_trivial_assign<int> t22;
typedef boost::has_trivial_constructor<int> t23;
typedef boost::has_trivial_copy<int> t24;
typedef boost::has_trivial_copy_constructor<int> t25;
typedef boost::has_trivial_default_constructor<int> t26;
typedef boost::has_trivial_destructor<int> t27;
typedef boost::has_virtual_destructor<int> t28;
typedef boost::integral_constant<int, 2> t29;
typedef boost::integral_promotion<short>::type t30;
typedef boost::is_abstract<int>::type t31;
typedef boost::is_arithmetic<int>::type t32;
typedef boost::is_array<int>::type t33;
typedef boost::is_base_of<int, long>::type t34;
typedef boost::is_class<int>::type t35;
typedef boost::is_complex<int>::type t36;
typedef boost::is_compound<int>::type t37;
typedef boost::is_const<int>::type t38;
typedef boost::is_convertible<int, long>::type t39;
typedef boost::is_empty<int>::type t40;
typedef boost::is_enum<int>::type t41;
typedef boost::is_floating_point<int>::type t42;
typedef boost::is_function<int>::type t43;
typedef boost::is_fundamental<int>::type t44;
typedef boost::is_integral<int>::type t45;
typedef boost::is_lvalue_reference<int>::type t46;
typedef boost::is_member_function_pointer<int>::type t47;
typedef boost::is_member_object_pointer<int>::type t48;
typedef boost::is_member_pointer<int>::type t49;
typedef boost::is_object<int>::type t50;
typedef boost::is_pod<int>::type t51;
typedef boost::is_pointer<int>::type t52;
typedef boost::is_polymorphic<int>::type t53;
typedef boost::is_reference<int>::type t54;
typedef boost::is_rvalue_reference<int>::type t55;
typedef boost::is_same<int, int>::type t56;
typedef boost::is_scalar<int>::type t57;
typedef boost::is_signed<int>::type t58;
typedef boost::is_stateless<int>::type t59;
typedef boost::is_union<int>::type t60;
typedef boost::is_unsigned<int>::type t61;
typedef boost::is_virtual_base_of<int, int>::type t62;
typedef boost::is_void<int>::type t63;
typedef boost::is_volatile<int>::type t64;
typedef boost::make_signed<int>::type t65;
typedef boost::make_unsigned<int>::type t66;
typedef boost::promote<int>::type t67;
typedef boost::rank<int>::type t68;
typedef boost::remove_all_extents<int>::type t69;
typedef boost::remove_const<int>::type t70;
typedef boost::remove_cv<int>::type t71;
typedef boost::remove_extent<int>::type t72;
typedef boost::remove_pointer<int>::type t73;
typedef boost::remove_reference<int>::type t74;
typedef boost::remove_volatile<int>::type t75;
typedef boost::type_with_alignment<4>::type t76;
int main()
{
return 0;
}