[LLD][COFF] Emit locally imported EC symbols for ARM64X (#125527)
[llvm-project.git] / libcxx / test / std / utilities / function.objects / bitwise.operations / bit_and.pass.cpp
blob621479b51ac9931a8b1b3902b6dca2c318be4bbf
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 //===----------------------------------------------------------------------===//
9 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
11 // <functional>
13 // bit_and
15 #include <functional>
16 #include <type_traits>
17 #include <cassert>
19 #include "test_macros.h"
21 int main(int, char**)
23 typedef std::bit_and<int> F;
24 const F f = F();
25 #if TEST_STD_VER <= 17
26 static_assert((std::is_same<int, F::first_argument_type>::value), "" );
27 static_assert((std::is_same<int, F::second_argument_type>::value), "" );
28 static_assert((std::is_same<int, F::result_type>::value), "" );
29 #endif
30 assert(f(0xEA95, 0xEA95) == 0xEA95);
31 assert(f(0xEA95, 0x58D3) == 0x4891);
32 assert(f(0x58D3, 0xEA95) == 0x4891);
33 assert(f(0x58D3, 0) == 0);
34 assert(f(0xFFFF, 0x58D3) == 0x58D3);
35 #if TEST_STD_VER > 11
36 typedef std::bit_and<> F2;
37 const F2 f2 = F2();
38 assert(f2(0xEA95, 0xEA95) == 0xEA95);
39 assert(f2(0xEA95L, 0xEA95) == 0xEA95);
40 assert(f2(0xEA95, 0xEA95L) == 0xEA95);
42 assert(f2(0xEA95, 0x58D3) == 0x4891);
43 assert(f2(0xEA95L, 0x58D3) == 0x4891);
44 assert(f2(0xEA95, 0x58D3L) == 0x4891);
46 assert(f2(0x58D3, 0xEA95) == 0x4891);
47 assert(f2(0x58D3L, 0xEA95) == 0x4891);
48 assert(f2(0x58D3, 0xEA95L) == 0x4891);
50 assert(f2(0x58D3, 0) == 0);
51 assert(f2(0x58D3L, 0) == 0);
52 assert(f2(0x58D3, 0L) == 0);
54 assert(f2(0xFFFF, 0x58D3) == 0x58D3);
55 assert(f2(0xFFFFL, 0x58D3) == 0x58D3);
56 assert(f2(0xFFFF, 0x58D3L) == 0x58D3);
58 constexpr int foo = std::bit_and<int> () (0x58D3, 0xEA95);
59 static_assert ( foo == 0x4891, "" );
61 constexpr int bar = std::bit_and<> () (0x58D3L, 0xEA95);
62 static_assert ( bar == 0x4891, "" );
63 #endif
65 return 0;