blob: d64c02f97cd48c70695bb6b07dd15a590c113461 [file] [log] [blame]
Marshall Clow354d39c2014-01-16 16:58:45 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Asiri Rathnayake6edc12c2016-05-28 08:57:35 +000010// UNSUPPORTED: c++98, c++03, c++11
Marshall Clow75f9aa92013-08-13 01:12:41 +000011#include <functional>
12#include <string>
13
Stephan T. Lavavejaae63562017-08-11 20:53:53 +000014template <class T>
Marshall Clow75f9aa92013-08-13 01:12:41 +000015struct is_transparent
16{
17private:
Stephan T. Lavavej709be5e2017-08-11 20:54:09 +000018 struct two {char lx; char lxx;};
19 template <class U> static two test(...);
20 template <class U> static char test(typename U::is_transparent* = 0);
Marshall Clow75f9aa92013-08-13 01:12:41 +000021public:
Stephan T. Lavavej709be5e2017-08-11 20:54:09 +000022 static const bool value = sizeof(test<T>(0)) == 1;
Marshall Clow75f9aa92013-08-13 01:12:41 +000023};
24
25
Asiri Rathnayake6edc12c2016-05-28 08:57:35 +000026int main ()
27{
Marshall Clow75f9aa92013-08-13 01:12:41 +000028 static_assert ( !is_transparent<std::logical_and<int>>::value, "" );
29 static_assert ( !is_transparent<std::logical_and<std::string>>::value, "" );
30 static_assert ( is_transparent<std::logical_and<void>>::value, "" );
31 static_assert ( is_transparent<std::logical_and<>>::value, "" );
32
33 static_assert ( !is_transparent<std::logical_or<int>>::value, "" );
34 static_assert ( !is_transparent<std::logical_or<std::string>>::value, "" );
35 static_assert ( is_transparent<std::logical_or<void>>::value, "" );
36 static_assert ( is_transparent<std::logical_or<>>::value, "" );
37
38 static_assert ( !is_transparent<std::logical_not<int>>::value, "" );
39 static_assert ( !is_transparent<std::logical_not<std::string>>::value, "" );
40 static_assert ( is_transparent<std::logical_not<void>>::value, "" );
41 static_assert ( is_transparent<std::logical_not<>>::value, "" );
Eric Fiselierd04c6852016-06-01 21:35:39 +000042
Marshall Clow75f9aa92013-08-13 01:12:41 +000043 return 0;
Asiri Rathnayake6edc12c2016-05-28 08:57:35 +000044}