forked from boostorg/type_traits
Move private-constructor tests into separate file.
These tests fail on older GCC versions.
This commit is contained in:
@ -37,15 +37,6 @@ struct deleted_default_construct
|
||||
|
||||
#endif
|
||||
|
||||
struct private_default_construct
|
||||
{
|
||||
private:
|
||||
private_default_construct();
|
||||
public:
|
||||
private_default_construct(char val) : member(val) {}
|
||||
char member;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CXX11_NOEXCEPT
|
||||
struct noexcept_default_construct
|
||||
{
|
||||
@ -210,7 +201,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<bug11324_derived>::v
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<deleted_default_construct>::value, false);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<private_default_construct>::value, false);
|
||||
#ifndef BOOST_NO_CXX11_NOEXCEPT
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<noexcept_default_construct>::value, true);
|
||||
#endif
|
||||
|
@ -12,13 +12,6 @@
|
||||
# include <boost/type_traits/has_nothrow_copy.hpp>
|
||||
#endif
|
||||
|
||||
struct non_copy
|
||||
{
|
||||
non_copy();
|
||||
private:
|
||||
non_copy(const non_copy&);
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
|
||||
struct delete_copy
|
||||
@ -237,10 +230,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<delete_copy>::value, false)
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<noexcept_copy>::value, true);
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<non_copy>::value, false);
|
||||
#endif
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
||||
|
@ -12,13 +12,6 @@
|
||||
# include <boost/type_traits/has_trivial_assign.hpp>
|
||||
#endif
|
||||
|
||||
struct non_assignable
|
||||
{
|
||||
non_assignable();
|
||||
private:
|
||||
non_assignable& operator=(const non_assignable&);
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
|
||||
struct non_assignable2
|
||||
@ -224,7 +217,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<test_abc1>::value, false)
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<non_assignable2>::value, false);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<non_assignable>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
@ -27,13 +27,6 @@ public:
|
||||
explicit bug11324_derived(char arg) : data(arg) {}
|
||||
};
|
||||
|
||||
struct private_construct
|
||||
{
|
||||
private_construct(int);
|
||||
private:
|
||||
private_construct();
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
|
||||
struct deleted_construct
|
||||
@ -204,7 +197,6 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<wrap<trivial_ex
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<test_abc1>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<bug11324_derived>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<private_construct>::value, false);
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<deleted_construct>::value, false);
|
||||
#endif
|
||||
|
@ -25,13 +25,6 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
struct private_copy
|
||||
{
|
||||
private_copy();
|
||||
private:
|
||||
private_copy(const private_copy&);
|
||||
};
|
||||
|
||||
TT_TEST_BEGIN(has_trivial_copy)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<bool>::value, true);
|
||||
@ -227,7 +220,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<test_abc1>::value, false);
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<bug_10389>::value, false);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<private_copy>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
@ -22,13 +22,6 @@ struct deleted_destruct
|
||||
|
||||
#endif
|
||||
|
||||
struct private_destruct
|
||||
{
|
||||
private_destruct();
|
||||
private:
|
||||
~private_destruct();
|
||||
};
|
||||
|
||||
TT_TEST_BEGIN(has_trivial_destructor)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<bool>::value, true);
|
||||
@ -187,7 +180,6 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<wrap<trivial_exc
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<wrap<trivial_except_construct> >::value, true, false);
|
||||
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<wrap<trivial_except_assign> >::value, true, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<private_destruct>::value, false);
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<deleted_destruct>::value, false);
|
||||
#endif
|
||||
|
@ -37,15 +37,6 @@ struct deleted_default_construct
|
||||
|
||||
#endif
|
||||
|
||||
struct private_default_construct
|
||||
{
|
||||
private:
|
||||
private_default_construct();
|
||||
public:
|
||||
private_default_construct(char val) : member(val) {}
|
||||
char member;
|
||||
};
|
||||
|
||||
TT_TEST_BEGIN(is_default_constructible)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<bool>::value, true);
|
||||
@ -198,7 +189,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<bug11324_derived>::
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<deleted_default_construct>::value, false);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<private_default_construct>::value, false);
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
@ -14,13 +14,6 @@
|
||||
# include <boost/type_traits/is_nothrow_move_constructible.hpp>
|
||||
#endif
|
||||
|
||||
struct non_copy
|
||||
{
|
||||
non_copy();
|
||||
private:
|
||||
non_copy(const non_copy&);
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
|
||||
struct delete_copy
|
||||
@ -245,8 +238,6 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_assign
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_construct_UDT>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<test_abc1>::value, false);
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<non_copy>::value, false);
|
||||
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<delete_copy>::value, false);
|
||||
#endif
|
||||
|
71
test/tricky_private_member_test.cpp
Normal file
71
test/tricky_private_member_test.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
|
||||
// (C) Copyright John Maddock 2015.
|
||||
// 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.hpp>
|
||||
#endif
|
||||
|
||||
struct private_default_construct
|
||||
{
|
||||
private:
|
||||
private_default_construct();
|
||||
public:
|
||||
private_default_construct(char val) : member(val) {}
|
||||
char member;
|
||||
};
|
||||
|
||||
struct non_copy
|
||||
{
|
||||
non_copy();
|
||||
private:
|
||||
non_copy(const non_copy&);
|
||||
};
|
||||
|
||||
struct non_assignable
|
||||
{
|
||||
non_assignable();
|
||||
private:
|
||||
non_assignable& operator=(const non_assignable&);
|
||||
};
|
||||
|
||||
struct private_copy
|
||||
{
|
||||
private_copy();
|
||||
private:
|
||||
private_copy(const private_copy&);
|
||||
};
|
||||
|
||||
struct private_destruct
|
||||
{
|
||||
private_destruct();
|
||||
private:
|
||||
~private_destruct();
|
||||
};
|
||||
|
||||
|
||||
|
||||
TT_TEST_BEGIN(tricky_private_members_test)
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_constructor<private_default_construct>::value, false);
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_nothrow_copy<non_copy>::value, false);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign<non_assignable>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<private_default_construct>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy<private_copy>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor<private_destruct>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<private_default_construct>::value, false);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<non_copy>::value, false);
|
||||
|
||||
|
||||
|
||||
TT_TEST_END
|
||||
|
||||
|
Reference in New Issue
Block a user