| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 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 |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03, c++11 |
| 10 | #include <functional> |
| 11 | #include <string> |
| 12 | |
| 13 | #include "test_macros.h" |
| 14 | |
| 15 | template <class T> |
| 16 | struct is_transparent |
| 17 | { |
| 18 | private: |
| 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); |
| 22 | public: |
| 23 | static const bool value = sizeof(test<T>(0)) == 1; |
| 24 | }; |
| 25 | |
| 26 | |
| 27 | int main(int, char**) |
| 28 | { |
| 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, "" ); |
| 43 | |
| 44 | return 0; |
| 45 | } |
| 46 | |