| 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 | //===----------------------------------------------------------------------===// |
| 8 | // REQUIRES: std-at-least-c++20 |
| 9 | |
| 10 | // <chrono> |
| 11 | |
| 12 | // time_point |
| 13 | |
| 14 | // constexpr time_point operator++(int); |
| 15 | |
| 16 | #include <cassert> |
| 17 | #include <chrono> |
| 18 | |
| 19 | #include "test_macros.h" |
| 20 | |
| 21 | constexpr bool test() { |
| 22 | using Clock = std::chrono::system_clock; |
| 23 | using Duration = std::chrono::milliseconds; |
| 24 | std::chrono::time_point<Clock, Duration> t1{Duration{3}}; |
| 25 | std::chrono::time_point<Clock, Duration> t2{t1++}; |
| 26 | assert(t1.time_since_epoch() == Duration{4}); |
| 27 | assert(t2.time_since_epoch() == Duration{3}); |
| 28 | return true; |
| 29 | } |
| 30 | |
| 31 | int main(int, char**) { |
| 32 | test(); |
| 33 | static_assert(test()); |
| 34 | return 0; |
| 35 | } |
| 36 | |