43 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <chrono>10 11// duration12 13// constexpr duration& operator++(); // constexpr in C++1714 15#include <chrono>16#include <cassert>17 18#include "test_macros.h"19 20#if TEST_STD_VER > 1421constexpr bool test_constexpr()22{23 std::chrono::hours h(3);24 return (++h).count() == 4;25}26#endif27 28int main(int, char**)29{30 {31 std::chrono::hours h(3);32 std::chrono::hours& href = ++h;33 assert(&href == &h);34 assert(h.count() == 4);35 }36 37#if TEST_STD_VER > 1438 static_assert(test_constexpr(), "");39#endif40 41 return 0;42}43