[SLP] Make getSameOpcode support different instructions if they have same semantics...
[llvm-project.git] / libcxx / test / std / numerics / complex.number / complex.member.ops / minus_equal_scalar.pass.cpp
blobb9b240cefea747df05b20a81a79a9ad1ef15ea89
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 // <complex>
11 // complex& operator-=(const T& rhs); // constexpr in C++20
13 #include <complex>
14 #include <cassert>
16 #include "test_macros.h"
18 template <class T>
19 TEST_CONSTEXPR_CXX20
20 bool
21 test()
23 std::complex<T> c;
24 assert(c.real() == 0);
25 assert(c.imag() == 0);
26 c -= 1.5;
27 assert(c.real() == -1.5);
28 assert(c.imag() == 0);
29 c -= 1.5;
30 assert(c.real() == -3);
31 assert(c.imag() == 0);
32 c -= -1.5;
33 assert(c.real() == -1.5);
34 assert(c.imag() == 0);
35 return true;
38 int main(int, char**)
40 test<float>();
41 test<double>();
42 test<long double>();
44 #if TEST_STD_VER >= 20
45 static_assert(test<float>());
46 static_assert(test<double>());
47 static_assert(test<long double>());
48 #endif
50 return 0;