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++98, c++03, c++11 10 #include <functional> 11 #include <string> 12 13 template <class T> 14 struct is_transparent 15 { 16 private: 17 struct two {char lx; char lxx;}; 18 template <class U> static two test(...); 19 template <class U> static char test(typename U::is_transparent* = 0); 20 public: 21 static const bool value = sizeof(test<T>(0)) == 1; 22 }; 23 24 25 int main(int, char**) { 26 static_assert ( !is_transparent<std::bit_and<int>>::value, "" ); 27 static_assert ( !is_transparent<std::bit_and<std::string>>::value, "" ); 28 static_assert ( is_transparent<std::bit_and<void>>::value, "" ); 29 static_assert ( is_transparent<std::bit_and<>>::value, "" ); 30 31 static_assert ( !is_transparent<std::bit_or<int>>::value, "" ); 32 static_assert ( !is_transparent<std::bit_or<std::string>>::value, "" ); 33 static_assert ( is_transparent<std::bit_or<void>>::value, "" ); 34 static_assert ( is_transparent<std::bit_or<>>::value, "" ); 35 36 static_assert ( !is_transparent<std::bit_xor<int>>::value, "" ); 37 static_assert ( !is_transparent<std::bit_xor<std::string>>::value, "" ); 38 static_assert ( is_transparent<std::bit_xor<void>>::value, "" ); 39 static_assert ( is_transparent<std::bit_xor<>>::value, "" ); 40 41 static_assert ( !is_transparent<std::bit_not<int>>::value, "" ); 42 static_assert ( !is_transparent<std::bit_not<std::string>>::value, "" ); 43 static_assert ( is_transparent<std::bit_not<void>>::value, "" ); 44 static_assert ( is_transparent<std::bit_not<>>::value, "" ); 45 46 return 0; 47 } 48