[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / utilities / function.objects / arithmetic.operations / negate.pass.cpp
blobfd3d5f5f0700f7aab3427fb34c841d5341e3f049
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 // negate
15 #include <functional>
16 #include <type_traits>
17 #include <cassert>
19 #include "test_macros.h"
21 int main(int, char**)
23 typedef std::negate<int> F;
24 const F f = F();
25 #if TEST_STD_VER <= 17
26 static_assert((std::is_same<F::argument_type, int>::value), "" );
27 static_assert((std::is_same<F::result_type, int>::value), "" );
28 #endif
29 assert(f(36) == -36);
30 #if TEST_STD_VER > 11
31 typedef std::negate<> F2;
32 const F2 f2 = F2();
33 assert(f2(36) == -36);
34 assert(f2(36L) == -36);
35 assert(f2(36.0) == -36);
37 constexpr int foo = std::negate<int> () (3);
38 static_assert ( foo == -3, "" );
40 constexpr double bar = std::negate<> () (3.0);
41 static_assert ( bar == -3.0, "" );
42 #endif
44 return 0;