[FMV][AArch64] Changes in fmv-features metadata. (#122192)
[llvm-project.git] / libcxx / test / std / time / time.duration / time.duration.arithmetic / op_+=.pass.cpp
blob4247f2d56893ad36b1850a1bfb3fd070b50c88e0
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 // <chrono>
11 // duration
13 // constexpr duration& operator+=(const duration& d); // constexpr in C++17
15 #include <chrono>
16 #include <cassert>
18 #include "test_macros.h"
20 #if TEST_STD_VER > 14
21 constexpr bool test_constexpr()
23 std::chrono::seconds s(3);
24 s += std::chrono::seconds(2);
25 if (s.count() != 5) return false;
26 s += std::chrono::minutes(2);
27 return s.count() == 125;
29 #endif
31 int main(int, char**)
34 std::chrono::seconds s(3);
35 s += std::chrono::seconds(2);
36 assert(s.count() == 5);
37 s += std::chrono::minutes(2);
38 assert(s.count() == 125);
41 #if TEST_STD_VER > 14
42 static_assert(test_constexpr(), "");
43 #endif
45 return 0;