Marshall Clow | 354d39c | 2014-01-16 16:58:45 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Marshall Clow | 354d39c | 2014-01-16 16:58:45 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
Asiri Rathnayake | 6edc12c | 2016-05-28 08:57:35 +0000 | [diff] [blame] | 9 | // UNSUPPORTED: c++98, c++03, c++11 |
Marshall Clow | 75f9aa9 | 2013-08-13 01:12:41 +0000 | [diff] [blame] | 10 | #include <functional> |
| 11 | #include <string> |
| 12 | |
Marshall Clow | 7fc6a55 | 2019-05-31 18:35:30 +0000 | [diff] [blame] | 13 | #include "test_macros.h" |
| 14 | |
Stephan T. Lavavej | aae6356 | 2017-08-11 20:53:53 +0000 | [diff] [blame] | 15 | template <class T> |
Marshall Clow | 75f9aa9 | 2013-08-13 01:12:41 +0000 | [diff] [blame] | 16 | struct is_transparent |
| 17 | { |
| 18 | private: |
Stephan T. Lavavej | 709be5e | 2017-08-11 20:54:09 +0000 | [diff] [blame] | 19 | struct two {char lx; char lxx;}; |
| 20 | template <class U> static two test(...); |
| 21 | template <class U> static char test(typename U::is_transparent* = 0); |
Marshall Clow | 75f9aa9 | 2013-08-13 01:12:41 +0000 | [diff] [blame] | 22 | public: |
Stephan T. Lavavej | 709be5e | 2017-08-11 20:54:09 +0000 | [diff] [blame] | 23 | static const bool value = sizeof(test<T>(0)) == 1; |
Marshall Clow | 75f9aa9 | 2013-08-13 01:12:41 +0000 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | |
JF Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 27 | int main(int, char**) |
Asiri Rathnayake | 6edc12c | 2016-05-28 08:57:35 +0000 | [diff] [blame] | 28 | { |
Marshall Clow | 75f9aa9 | 2013-08-13 01:12:41 +0000 | [diff] [blame] | 29 | static_assert ( !is_transparent<std::logical_and<int>>::value, "" ); |
| 30 | static_assert ( !is_transparent<std::logical_and<std::string>>::value, "" ); |
| 31 | static_assert ( is_transparent<std::logical_and<void>>::value, "" ); |
| 32 | static_assert ( is_transparent<std::logical_and<>>::value, "" ); |
| 33 | |
| 34 | static_assert ( !is_transparent<std::logical_or<int>>::value, "" ); |
| 35 | static_assert ( !is_transparent<std::logical_or<std::string>>::value, "" ); |
| 36 | static_assert ( is_transparent<std::logical_or<void>>::value, "" ); |
| 37 | static_assert ( is_transparent<std::logical_or<>>::value, "" ); |
| 38 | |
| 39 | static_assert ( !is_transparent<std::logical_not<int>>::value, "" ); |
| 40 | static_assert ( !is_transparent<std::logical_not<std::string>>::value, "" ); |
| 41 | static_assert ( is_transparent<std::logical_not<void>>::value, "" ); |
| 42 | static_assert ( is_transparent<std::logical_not<>>::value, "" ); |
Eric Fiselier | d04c685 | 2016-06-01 21:35:39 +0000 | [diff] [blame] | 43 | |
Marshall Clow | 75f9aa9 | 2013-08-13 01:12:41 +0000 | [diff] [blame] | 44 | return 0; |
Asiri Rathnayake | 6edc12c | 2016-05-28 08:57:35 +0000 | [diff] [blame] | 45 | } |