forked from boostorg/type_traits
Merge type_traits bug fixes from Trunk.
[SVN r58216]
This commit is contained in:
1 parent
3ac7119088
commit
1335987b92
8 files changed
+113
-51
No files matched your search
@@ -22,7 +22,7 @@ namespace
|
||||
struct alignment_implementation1
|
||||
{
|
||||
boost::detail::aligned_storage::aligned_storage_imp<N,Alignment> type;
|
||||
const void* address() const { return this; }
|
||||
const void* address() const { return type.address(); }
|
||||
};
|
||||
|
||||
template< unsigned N, unsigned Alignment >
|
||||
@@ -39,24 +39,24 @@ namespace
|
||||
};
|
||||
|
||||
template< unsigned N, class T >
|
||||
const void* get_address1()
|
||||
std::ptrdiff_t get_address1()
|
||||
{
|
||||
alignment_implementation1<N*sizeof(T), tt::alignment_of<T>::value> imp1;
|
||||
return imp1.address();
|
||||
static alignment_implementation1<N*sizeof(T), tt::alignment_of<T>::value> imp1;
|
||||
return static_cast<const char*>(imp1.address()) - reinterpret_cast<const char*>(&imp1);
|
||||
}
|
||||
|
||||
template< unsigned N, class T >
|
||||
const void* get_address2()
|
||||
std::ptrdiff_t get_address2()
|
||||
{
|
||||
alignment_implementation2<N*sizeof(T), tt::alignment_of<T>::value> imp2;
|
||||
return imp2.address();
|
||||
static alignment_implementation2<N*sizeof(T), tt::alignment_of<T>::value> imp2;
|
||||
return static_cast<const char*>(imp2.address()) - reinterpret_cast<const char*>(&imp2);
|
||||
}
|
||||
|
||||
template< class T >
|
||||
void check()
|
||||
{
|
||||
const void* addr1 = get_address1<0,T>();
|
||||
const void* addr2 = get_address2<0,T>();
|
||||
std::ptrdiff_t addr1 = get_address1<0,T>();
|
||||
std::ptrdiff_t addr2 = get_address2<0,T>();
|
||||
//
|
||||
// @remark: only the empty case differs
|
||||
//
|
||||
@@ -101,6 +101,9 @@ check<long double>();
|
||||
#ifdef BOOST_HAS_MS_INT64
|
||||
check<__int64>();
|
||||
#endif
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
check<long long>();
|
||||
#endif
|
||||
|
||||
check<int(*)(int)>();
|
||||
check<int*>();
|
||||
|
||||
@@ -33,6 +33,16 @@ struct class_with_new_op6 {
|
||||
void* operator new[] (std::size_t size, void* ptr);
|
||||
};
|
||||
|
||||
struct class_with_all_ops
|
||||
{
|
||||
void * operator new(std::size_t);
|
||||
void* operator new(std::size_t size, const std::nothrow_t&);
|
||||
void* operator new[](std::size_t size);
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&);
|
||||
void* operator new (std::size_t size, void* ptr);
|
||||
void* operator new[] (std::size_t size, void* ptr);
|
||||
};
|
||||
|
||||
TT_TEST_BEGIN(has_new_operator)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op>::value, true);
|
||||
@@ -42,6 +52,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op3>::value,
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op4>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op5>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_new_op6>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<class_with_all_ops>::value, true);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<bool>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_new_operator<bool const>::value, false);
|
||||
|
||||
Executable → Regular
+4
@@ -13,6 +13,10 @@
|
||||
# include <boost/type_traits/is_abstract.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(disable: 4505)
|
||||
#endif
|
||||
|
||||
|
||||
struct TestA {};
|
||||
struct TestB { virtual void foo(void) = 0; };
|
||||
|
||||
@@ -407,6 +407,10 @@ struct wrap
|
||||
{
|
||||
T t;
|
||||
int j;
|
||||
protected:
|
||||
wrap();
|
||||
wrap(const wrap&);
|
||||
wrap& operator=(const wrap&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user