Add tests for improved binary operators.

This commit is contained in:
jzmaddock
2018-02-07 19:50:26 +00:00
parent e4d3cba6dd
commit e9399adefa
2 changed files with 28 additions and 0 deletions

View File

@ -86,6 +86,14 @@ inline bool operator BOOST_TT_TRAIT_OP (const C&, void*) { return true; }
inline bool operator BOOST_TT_TRAIT_OP (void*, const D&) { return true; }
inline bool operator BOOST_TT_TRAIT_OP (const C&, const D&) { return true; }
struct private_op { private: void operator BOOST_TT_TRAIT_OP (const private_op&); };
struct ambiguous_A
{
};
bool operator BOOST_TT_TRAIT_OP (const ambiguous_A&, const ambiguous_A&);
struct ambiguous_B { operator ambiguous_A()const; };
//class internal_private { ret operator BOOST_TT_TRAIT_OP (const internal_private&) const; };
void common() {
@ -144,6 +152,17 @@ void common() {
TEST_TR(Derived2, bool, true);
// compile time error
// TEST_T(internal_private, false);
#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1900)
// There are some things that pass that wouldn't otherwise do so:
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1910)
TEST_TR(private_op, bool, false);
TEST_T(private_op, false);
#endif
TEST_TR(ambiguous_A, bool, true);
TEST_T(ambiguous_A, true);
TEST_TR(ambiguous_B, bool, true);
TEST_T(ambiguous_B, true);
#endif
}
}

View File

@ -219,6 +219,15 @@ void specific() {
BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int* &, int & >::value), 0);
BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int* const &, int const & >::value), 1);
#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1900)
// There are some things that pass that wouldn't otherwise do so:
auto f = []() {};
#ifndef BOOST_MSVC
TEST_TR(decltype(f), bool, true);
#else
TEST_TR(decltype(f), bool, false);
#endif
#endif
}
TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME)