Merge change from Trunk to release.

[SVN r71481]
This commit is contained in:
John Maddock committed 2011-04-25 12:26:48 +00:00
1 parent 023bec7ba0
commit e1a315e00e
170 files changed
+1098 -446

No files matched your search

+26
View File
@@ -40,6 +40,32 @@ do{\
<< BOOST_STRINGIZE(expression) << "\"");\
}while(0)
#define BOOST_CHECK_TYPE3(type_expression, type_expression_suffix, expected_type)\
do{\
if(!::boost::is_same< type_expression, type_expression_suffix, expected_type >::value){\
BOOST_CHECK_MESSAGE(false, "The expression: \"" << BOOST_STRINGIZE(expression)\
<< "\" did not have the expected type:\n\tevaluating: boost::is_same<"\
<< BOOST_STRINGIZE((type_expression, type_expression_suffix)) << ", " << BOOST_STRINGIZE(expected_type)\
<< ">" << "\n\tfound: "\
<< typeid(::boost::is_same< type_expression, type_expression_suffix, expected_type >).name());\
}else\
BOOST_CHECK_MESSAGE(true, "Validating Type Expression: \""\
<< BOOST_STRINGIZE(expression) << "\"");\
}while(0)
#define BOOST_CHECK_TYPE4(type_expression, suffix1, suffix2, expected_type)\
do{\
if(!::boost::is_same< type_expression, suffix1, suffix2, expected_type >::value){\
BOOST_CHECK_MESSAGE(false, "The expression: \"" << BOOST_STRINGIZE(expression)\
<< "\" did not have the expected type:\n\tevaluating: boost::is_same<"\
<< BOOST_STRINGIZE((type_expression, suffix1, suffix2)) << ", " << BOOST_STRINGIZE(expected_type)\
<< ">" << "\n\tfound: "\
<< typeid(::boost::is_same< type_expression, suffix1, suffix2, expected_type >).name());\
}else\
BOOST_CHECK_MESSAGE(true, "Validating Type Expression: \""\
<< BOOST_STRINGIZE(expression) << "\"");\
}while(0)
#endif
+217
View File
@@ -0,0 +1,217 @@
// 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 BOOST_COMMON_TYPE_DONT_USE_TYPEOF 1
#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)
{
#ifndef __SUNPRO_CC
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
#endif
typedef tt::common_type<C1C2, C1>::type t1;
BOOST_CHECK_TYPE(t1, C1C2);
BOOST_CHECK_TYPE(tt::common_type<int>::type, int);
BOOST_CHECK_TYPE(tt::common_type<char>::type, char);
BOOST_CHECK_TYPE3(tt::common_type<char, char>::type, char);
BOOST_CHECK_TYPE3(tt::common_type<char, unsigned char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<char, short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<char, unsigned short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<char, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<char, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<char, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<char, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<char, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, unsigned char>::type, unsigned char);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, unsigned short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<short, char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<short, unsigned char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<short, short>::type, short);
BOOST_CHECK_TYPE3(tt::common_type<short, unsigned short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<short, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<short, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<short, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<short, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<short, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, unsigned char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, unsigned short>::type, unsigned short);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<int, char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, unsigned char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, unsigned short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<int, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<int, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<int, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, char>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, unsigned char>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, short>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, unsigned short>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, int>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, double>::type, double);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, char>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, unsigned char>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, short>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, unsigned short>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, int>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, unsigned int>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, boost::ulong_long_type>::type, boost::ulong_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, double>::type, double);
#endif
BOOST_CHECK_TYPE3(tt::common_type<double, char>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, unsigned char>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, short>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, unsigned short>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, int>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, unsigned int>::type, double);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<double, boost::long_long_type>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, boost::ulong_long_type>::type, double);
#endif
BOOST_CHECK_TYPE3(tt::common_type<double, double>::type, double);
BOOST_CHECK_TYPE4(tt::common_type<double, char, int>::type, double);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE4(tt::common_type<unsigned, char, boost::long_long_type>::type, boost::long_long_type);
#endif
}
TT_TEST_END
+103
View File
@@ -103,5 +103,108 @@ TT_TEST_BEGIN(common_type)
assignation_3<C2, C1C2, C1>();
assignation_3<C1C2, C2, C1>();
//assignation_3<C1, C2, C1C2>(); // fails because the common type is the third
BOOST_CHECK_TYPE(tt::common_type<int>::type, int);
BOOST_CHECK_TYPE(tt::common_type<char>::type, char);
BOOST_CHECK_TYPE3(tt::common_type<char, char>::type, char);
BOOST_CHECK_TYPE3(tt::common_type<char, unsigned char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<char, short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<char, unsigned short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<char, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<char, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<char, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<char, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<char, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, unsigned char>::type, unsigned char);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, unsigned short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<unsigned char, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<short, char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<short, unsigned char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<short, short>::type, short);
BOOST_CHECK_TYPE3(tt::common_type<short, unsigned short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<short, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<short, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<short, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<short, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<short, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, unsigned char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, unsigned short>::type, unsigned short);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<unsigned short, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<int, char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, unsigned char>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, unsigned short>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, int>::type, int);
BOOST_CHECK_TYPE3(tt::common_type<int, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<int, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<int, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<int, double>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, char>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, unsigned char>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, short>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, unsigned short>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, int>::type, unsigned int);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, unsigned int>::type, unsigned int);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, boost::ulong_long_type>::type, boost::ulong_long_type);
#endif
BOOST_CHECK_TYPE3(tt::common_type<unsigned int, double>::type, double);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, char>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, unsigned char>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, short>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, unsigned short>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, int>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, unsigned int>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, boost::long_long_type>::type, boost::long_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, boost::ulong_long_type>::type, boost::ulong_long_type);
BOOST_CHECK_TYPE3(tt::common_type<boost::long_long_type, double>::type, double);
#endif
BOOST_CHECK_TYPE3(tt::common_type<double, char>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, unsigned char>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, short>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, unsigned short>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, int>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, unsigned int>::type, double);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE3(tt::common_type<double, boost::long_long_type>::type, double);
BOOST_CHECK_TYPE3(tt::common_type<double, boost::ulong_long_type>::type, double);
#endif
BOOST_CHECK_TYPE3(tt::common_type<double, double>::type, double);
BOOST_CHECK_TYPE4(tt::common_type<double, char, int>::type, double);
#ifndef BOOST_NO_LONG_LONG
BOOST_CHECK_TYPE4(tt::common_type<unsigned, char, boost::long_long_type>::type, boost::long_long_type);
#endif
}
TT_TEST_END
+1 -1
View File
@@ -193,7 +193,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<void>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<void>::value, false);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_assign<POD_UDT>::value, true, false);
+1 -1
View File
@@ -151,7 +151,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int[3][2]>::value, t
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<void>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<void>::value, false);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<POD_UDT>::value, true, false);
+1 -1
View File
@@ -189,7 +189,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<void>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<void>::value, false);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<POD_UDT>::value, true, false);
+1 -1
View File
@@ -185,7 +185,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<void>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<void>::value, false);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_assign<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_assign<POD_UDT>::value, true, false);
+1 -1
View File
@@ -185,7 +185,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[3][2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<void>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<void>::value, false);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_copy<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_copy<POD_UDT>::value, true, false);
+1 -1
View File
@@ -154,7 +154,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int[3][2]>::value, tr
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<int[2][4][5][6][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<empty_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<void>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<void>::value, false);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<POD_UDT>::value, true, false);
+49 -10
View File
@@ -11,6 +11,8 @@
#else
# include <boost/type_traits/is_convertible.hpp>
#endif
#include <boost/utility/enable_if.hpp>
template <class T>
struct convertible_from
@@ -22,6 +24,37 @@ struct base2 { };
struct middle2 : public virtual base2 { };
struct derived2 : public middle2 { };
#if !defined(BOOST_NO_RVALUE_REFERENCES)
template<typename T>
struct test_bug_4530
{
template<typename A>
test_bug_4530(A&&, typename boost::enable_if<boost::is_convertible<A&&, T> >::type* =0);
};
struct A4530
{
template <class T>
A4530(T);
};
#endif
#ifdef BOOST_MSVC
struct bug_5271a
{
__declspec(align(16)) int value;
};
struct bug_5271b
{
__declspec(align(16)) int value;
bug_5271b(int v) : value(v) {}
};
#endif
TT_TEST_BEGIN(is_convertible)
@@ -49,7 +82,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int,test_abc1>::value), fals
#endif
// The following four do not compile without member template support:
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,void>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,void>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<void,void>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<void,float>::value), false);
@@ -102,7 +135,12 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<test_abc1&, test_abc2>::valu
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int, int_constructible>::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<float> >::value), true);
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);
//
// These two tests give different results with different compilers, we used to require *true* results
// from these, but C++0x behaviour requires *false*:
//
//BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<float&> >::value), false);
//BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<char,convertible_from<char&> >::value), false);
#if !(defined(__GNUC__) && (__GNUC__ < 4))
// GCC 3.x emits warnings here, which causes the tests to fail when we compile with warnings-as-errors:
@@ -113,7 +151,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float,convertible_from<char&
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<char,convertible_from<char> >::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<char,convertible_from<char const&> >::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<char,convertible_from<char&> >::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float&,convertible_from<float> >::value), true);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<float const&,convertible_from<float> >::value), true);
@@ -140,13 +177,15 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<__int64,char>::value), true)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<__int64,float>::value), true);
#endif
#ifndef BOOST_NO_RVALUE_REFERENCES
// Test bug case 4530:
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<test_bug_4530<A4530>,A4530>::value), true);
#endif
#if defined(BOOST_MSVC) && (BOOST_MSVC > 1310)
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int, bug_5271a>::value), false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible<int, bug_5271b>::value), true);
#endif
TT_TEST_END
+6 -1
View File
@@ -15,6 +15,7 @@
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_1, ::tt::remove_pointer, const, const)
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_2, ::tt::remove_pointer, volatile, volatile)
BOOST_DECL_TRANSFORM_TEST3(remove_pointer_test_3, ::tt::remove_pointer, *)
BOOST_DECL_TRANSFORM_TEST3(remove_pointer_test_3b, ::tt::remove_pointer, *const)
BOOST_DECL_TRANSFORM_TEST0(remove_pointer_test_4, ::tt::remove_pointer)
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_5, ::tt::remove_pointer, const &, const&)
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_6, ::tt::remove_pointer, &, &)
@@ -30,12 +31,15 @@ BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_5a, ::tt::remove_pointer, const &&
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_6a, ::tt::remove_pointer, &&, &&)
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_13a, ::tt::remove_pointer, (&&)[2], (&&)[2])
#endif
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_14, ::tt::remove_pointer, (*)(long), (long))
BOOST_DECL_TRANSFORM_TEST(remove_pointer_test_14b, ::tt::remove_pointer, (*const)(long), (long))
TT_TEST_BEGIN(remove_pointer)
remove_pointer_test_1();
remove_pointer_test_2();
remove_pointer_test_3();
remove_pointer_test_3b();
remove_pointer_test_4();
remove_pointer_test_5();
remove_pointer_test_6();
@@ -51,7 +55,8 @@ TT_TEST_BEGIN(remove_pointer)
remove_pointer_test_6a();
remove_pointer_test_13a();
#endif
remove_pointer_test_14();
remove_pointer_test_14b();
TT_TEST_END
+11
View File
@@ -7,6 +7,12 @@
#ifndef TT_TEST_HPP
#define TT_TEST_HPP
#include <boost/config.hpp>
#if defined(_WIN32_WCE) && defined(BOOST_MSVC)
#pragma warning(disable:4201)
#endif
#ifdef USE_UNIT_TEST
# include <boost/test/unit_test.hpp>
#endif
@@ -206,7 +212,12 @@ typedef int (UDT::*cmf)(int) const;
// on some compilers):
//
typedef int& r_type;
#ifndef BOOST_INTEL
typedef const r_type cr_type;
#else
// recent Intel compilers generate a hard error on the above:
typedef r_type cr_type;
#endif
# ifdef BOOST_MSVC
# pragma warning(pop)
# elif defined(BOOST_INTEL)