
Quite a few libcxx tests seem to follow the format: #if _LIBCPP_STD_VER > X // Do test. #else // Empty test. #endif We should instead use the UNSUPPORTED lit directive to exclude the test on earlier C++ standards. This gives us a more accurate number of test passes for those standards and avoids unnecessary conflicts with other lit directives on the same tests. Reviewers: bcraig, ericwf, mclow.lists Differential revision: http://reviews.llvm.org/D20730 llvm-svn: 271108
60 lines
2.5 KiB
C++
60 lines
2.5 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// UNSUPPORTED: c++98, c++03, c++11
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
template <class _Tp>
|
|
struct is_transparent
|
|
{
|
|
private:
|
|
struct __two {char __lx; char __lxx;};
|
|
template <class _Up> static __two __test(...);
|
|
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
|
|
public:
|
|
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
|
};
|
|
|
|
|
|
int main ()
|
|
{
|
|
static_assert ( !is_transparent<std::less<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::less<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::less<void>>::value, "" );
|
|
static_assert ( is_transparent<std::less<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::less_equal<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::less_equal<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::less_equal<void>>::value, "" );
|
|
static_assert ( is_transparent<std::less_equal<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::equal_to<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::equal_to<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::equal_to<void>>::value, "" );
|
|
static_assert ( is_transparent<std::equal_to<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::not_equal_to<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::not_equal_to<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::not_equal_to<void>>::value, "" );
|
|
static_assert ( is_transparent<std::not_equal_to<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::greater<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::greater<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::greater<void>>::value, "" );
|
|
static_assert ( is_transparent<std::greater<>>::value, "" );
|
|
|
|
static_assert ( !is_transparent<std::greater_equal<int>>::value, "" );
|
|
static_assert ( !is_transparent<std::greater_equal<std::string>>::value, "" );
|
|
static_assert ( is_transparent<std::greater_equal<void>>::value, "" );
|
|
static_assert ( is_transparent<std::greater_equal<>>::value, "" );
|
|
|
|
return 0;
|
|
}
|