From 7a4e3742800a581026478304aade40566031d38d Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 13 Aug 2013 01:12:41 +0000 Subject: [PATCH] More support for N3657; tests for is_transparent git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188242 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../transparent.pass.cpp | 52 +++++++++++++++++++ .../bitwise.operations/transparent.pass.cpp | 42 +++++++++++++++ .../comparisons/transparent.pass.cpp | 52 +++++++++++++++++++ .../logical.operations/transparent.pass.cpp | 37 +++++++++++++ 4 files changed, 183 insertions(+) create mode 100644 test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp create mode 100644 test/utilities/function.objects/bitwise.operations/transparent.pass.cpp create mode 100644 test/utilities/function.objects/comparisons/transparent.pass.cpp create mode 100644 test/utilities/function.objects/logical.operations/transparent.pass.cpp diff --git a/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp b/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp new file mode 100644 index 00000000..43e2e212 --- /dev/null +++ b/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp @@ -0,0 +1,52 @@ +#include +#include + +template +struct is_transparent +{ +private: + struct __two {char __lx; char __lxx;}; + template static __two __test(...); + template static char __test(typename _Up::is_transparent* = 0); +public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; +}; + + +int main () { +#if _LIBCPP_STD_VER > 11 + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + +#endif + + return 0; + } diff --git a/test/utilities/function.objects/bitwise.operations/transparent.pass.cpp b/test/utilities/function.objects/bitwise.operations/transparent.pass.cpp new file mode 100644 index 00000000..91d263ed --- /dev/null +++ b/test/utilities/function.objects/bitwise.operations/transparent.pass.cpp @@ -0,0 +1,42 @@ +#include +#include + +template +struct is_transparent +{ +private: + struct __two {char __lx; char __lxx;}; + template static __two __test(...); + template static char __test(typename _Up::is_transparent* = 0); +public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; +}; + + +int main () { +#if _LIBCPP_STD_VER > 11 + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + +#endif + + return 0; + } diff --git a/test/utilities/function.objects/comparisons/transparent.pass.cpp b/test/utilities/function.objects/comparisons/transparent.pass.cpp new file mode 100644 index 00000000..516b3644 --- /dev/null +++ b/test/utilities/function.objects/comparisons/transparent.pass.cpp @@ -0,0 +1,52 @@ +#include +#include + +template +struct is_transparent +{ +private: + struct __two {char __lx; char __lxx;}; + template static __two __test(...); + template static char __test(typename _Up::is_transparent* = 0); +public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; +}; + + +int main () { +#if _LIBCPP_STD_VER > 11 + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + +#endif + + return 0; + } diff --git a/test/utilities/function.objects/logical.operations/transparent.pass.cpp b/test/utilities/function.objects/logical.operations/transparent.pass.cpp new file mode 100644 index 00000000..5b3e1877 --- /dev/null +++ b/test/utilities/function.objects/logical.operations/transparent.pass.cpp @@ -0,0 +1,37 @@ +#include +#include + +template +struct is_transparent +{ +private: + struct __two {char __lx; char __lxx;}; + template static __two __test(...); + template static char __test(typename _Up::is_transparent* = 0); +public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; +}; + + +int main () { +#if _LIBCPP_STD_VER > 11 + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + + static_assert ( !is_transparent>::value, "" ); + static_assert ( !is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + static_assert ( is_transparent>::value, "" ); + +#endif + + return 0; + }