1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11
10 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
17 #include <type_traits>
20 #include "test_macros.h"
24 typedef std::bit_not
<int> F
;
26 #if TEST_STD_VER <= 17
27 static_assert((std::is_same
<F::argument_type
, int>::value
), "" );
28 static_assert((std::is_same
<F::result_type
, int>::value
), "" );
30 assert((f(0xEA95) & 0xFFFF ) == 0x156A);
31 assert((f(0x58D3) & 0xFFFF ) == 0xA72C);
32 assert((f(0) & 0xFFFF ) == 0xFFFF);
33 assert((f(0xFFFF) & 0xFFFF ) == 0);
35 typedef std::bit_not
<> F2
;
37 assert((f2(0xEA95) & 0xFFFF ) == 0x156A);
38 assert((f2(0xEA95L
) & 0xFFFF ) == 0x156A);
39 assert((f2(0x58D3) & 0xFFFF ) == 0xA72C);
40 assert((f2(0x58D3L
) & 0xFFFF ) == 0xA72C);
41 assert((f2(0) & 0xFFFF ) == 0xFFFF);
42 assert((f2(0L) & 0xFFFF ) == 0xFFFF);
43 assert((f2(0xFFFF) & 0xFFFF ) == 0);
44 assert((f2(0xFFFFL
) & 0xFFFF ) == 0);
46 constexpr int foo
= std::bit_not
<int> () (0xEA95) & 0xFFFF;
47 static_assert ( foo
== 0x156A, "" );
49 constexpr int bar
= std::bit_not
<> () (0xEA95) & 0xFFFF;
50 static_assert ( bar
== 0x156A, "" );