4 changes: 4 additions & 0 deletions test/Jamfile.v2
Expand Up @@ -39,6 +39,10 @@ rule all-tests {
{
result += [ run $(source) ] ;
}
for local source in [ glob compile_fail/*.cpp ]
{
result += [ compile-fail $(source) ] ;
}
#
# These traits have both intrinsic support, and a std conforming version, test a version with intrinsics disabled for better code coverage:
#
Expand Down
15 changes: 15 additions & 0 deletions test/compile_fail/common_type2_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/common_type.hpp>
#include "../test.hpp"

int main()
{
return sizeof(boost::common_type<int, incomplete_type>::type);
}


15 changes: 15 additions & 0 deletions test/compile_fail/common_type_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/common_type.hpp>
#include "../test.hpp"

int main()
{
return sizeof(boost::common_type<incomplete_type, int>::type);
}


15 changes: 15 additions & 0 deletions test/compile_fail/has_nothrow_assign_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/has_nothrow_assign.hpp>
#include "../test.hpp"

int main()
{
return boost::has_nothrow_assign<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/has_nothrow_cons_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/has_nothrow_constructor.hpp>
#include "../test.hpp"

int main()
{
return boost::has_nothrow_constructor<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/has_nothrow_copy_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/has_nothrow_copy.hpp>
#include "../test.hpp"

int main()
{
return boost::has_nothrow_copy<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/has_nothrow_destruct_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/has_nothrow_destructor.hpp>
#include "../test.hpp"

int main()
{
return boost::has_nothrow_destructor<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_assignable_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_assignable.hpp>
#include "../test.hpp"

int main()
{
return boost::is_assignable<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_base_of_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_base_of.hpp>
#include "../test.hpp"

int main()
{
return boost::is_base_of<UDT, incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_constructible_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_constructible.hpp>
#include "../test.hpp"

int main()
{
return boost::is_constructible<incomplete_type, int>::value;
}


19 changes: 19 additions & 0 deletions test/compile_fail/is_convertible2_fail.cpp
@@ -0,0 +1,19 @@

// (C) Copyright John Maddock 2017.
// 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/is_convertible.hpp>
#include "../test.hpp"

#if defined(CI_SUPPRESS_KNOWN_ISSUES) && defined(BOOST_MSVC) && (BOOST_MSVC <= 1800)
#error "Sorry check doesn't work"
#endif

int main()
{
return boost::is_convertible<incomplete_type, UDT>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_convertible_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_convertible.hpp>
#include "../test.hpp"

int main()
{
return boost::is_convertible<UDT, incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_copy_assignable_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_copy_assignable.hpp>
#include "../test.hpp"

int main()
{
return boost::is_copy_assignable<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_copy_constructible_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_copy_constructible.hpp>
#include "../test.hpp"

int main()
{
return boost::is_copy_constructible<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_default_constructible_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_default_constructible.hpp>
#include "../test.hpp"

int main()
{
return boost::is_default_constructible<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_destructible_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_destructible.hpp>
#include "../test.hpp"

int main()
{
return boost::is_destructible<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_empty_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_empty.hpp>
#include "../test.hpp"

int main()
{
return boost::is_empty<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_list_constructible_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_list_constructible.hpp>
#include "../test.hpp"

int main()
{
return boost::is_list_constructible<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_nothrow_move_assignable_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_nothrow_move_assignable.hpp>
#include "../test.hpp"

int main()
{
return boost::is_nothrow_move_assignable<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_nothrow_move_constructible_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_nothrow_move_constructible.hpp>
#include "../test.hpp"

int main()
{
return boost::is_nothrow_move_constructible<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_polymorphic_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_polymorphic.hpp>
#include "../test.hpp"

int main()
{
return boost::is_polymorphic<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_stateless_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_stateless.hpp>
#include "../test.hpp"

int main()
{
return boost::is_stateless<incomplete_type>::value;
}


15 changes: 15 additions & 0 deletions test/compile_fail/is_virtual_base_of_fail.cpp
@@ -0,0 +1,15 @@

// (C) Copyright John Maddock 2017.
// 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/is_virtual_base_of.hpp>
#include "../test.hpp"

int main()
{
return boost::is_virtual_base_of<UDT, incomplete_type>::value;
}


55 changes: 55 additions & 0 deletions test/is_complete_test.cpp
@@ -0,0 +1,55 @@

// (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.boost.org/LICENSE_1_0.txt)

#ifdef TEST_STD
# include <type_traits>
#else
# include <boost/type_traits/is_complete.hpp>
#endif
#include "test.hpp"
#include "check_integral_constant.hpp"

TT_TEST_BEGIN(is_complete)

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const volatile>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int volatile&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const volatile&>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int*>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const*>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int volatile*>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const volatile*>::value, true);

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const[3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int volatile[2][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const volatile[4][5][6]>::value, true);
#ifndef BOOST_NO_SFINAE
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int[]>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<enum_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<f1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<mf1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<cmf>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<mf8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<union_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<test_abc1>::value, true);
#ifndef BOOST_NO_SFINAE
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<incomplete_type>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<polymorphic_base>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<virtual_inherit6>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<foo0_t>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<foo4_t>::value, true);

TT_TEST_END