blob: b2353473b53273dfebc2adf6038b18dbf97f12c6 [file] [log] [blame]
Marshall Clow354d39c2014-01-16 16:58:45 +00001//===----------------------------------------------------------------------===//
2//
Chandler Carruth57b08b02019-01-19 10:56:40 +00003// 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 Clow354d39c2014-01-16 16:58:45 +00006//
7//===----------------------------------------------------------------------===//
8
Asiri Rathnayake6edc12c2016-05-28 08:57:35 +00009// UNSUPPORTED: c++98, c++03, c++11
Marshall Clow75f9aa92013-08-13 01:12:41 +000010#include <functional>
11#include <string>
12
Marshall Clow7fc6a552019-05-31 18:35:30 +000013#include "test_macros.h"
14
Stephan T. Lavavejaae63562017-08-11 20:53:53 +000015template <class T>
Marshall Clow75f9aa92013-08-13 01:12:41 +000016struct is_transparent
17{
18private:
Stephan T. Lavavej709be5e2017-08-11 20:54:09 +000019 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 Clow75f9aa92013-08-13 01:12:41 +000022public:
Stephan T. Lavavej709be5e2017-08-11 20:54:09 +000023 static const bool value = sizeof(test<T>(0)) == 1;
Marshall Clow75f9aa92013-08-13 01:12:41 +000024};
25
26
JF Bastien2df59c52019-02-04 20:31:13 +000027int main(int, char**) {
Marshall Clow75f9aa92013-08-13 01:12:41 +000028 static_assert ( !is_transparent<std::bit_and<int>>::value, "" );
29 static_assert ( !is_transparent<std::bit_and<std::string>>::value, "" );
30 static_assert ( is_transparent<std::bit_and<void>>::value, "" );
31 static_assert ( is_transparent<std::bit_and<>>::value, "" );
32
33 static_assert ( !is_transparent<std::bit_or<int>>::value, "" );
34 static_assert ( !is_transparent<std::bit_or<std::string>>::value, "" );
35 static_assert ( is_transparent<std::bit_or<void>>::value, "" );
36 static_assert ( is_transparent<std::bit_or<>>::value, "" );
37
38 static_assert ( !is_transparent<std::bit_xor<int>>::value, "" );
39 static_assert ( !is_transparent<std::bit_xor<std::string>>::value, "" );
40 static_assert ( is_transparent<std::bit_xor<void>>::value, "" );
41 static_assert ( is_transparent<std::bit_xor<>>::value, "" );
42
43 static_assert ( !is_transparent<std::bit_not<int>>::value, "" );
44 static_assert ( !is_transparent<std::bit_not<std::string>>::value, "" );
45 static_assert ( is_transparent<std::bit_not<void>>::value, "" );
46 static_assert ( is_transparent<std::bit_not<>>::value, "" );
Eric Fiselierd04c6852016-06-01 21:35:39 +000047
Marshall Clow75f9aa92013-08-13 01:12:41 +000048 return 0;
Asiri Rathnayake6edc12c2016-05-28 08:57:35 +000049}