41 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// duration() = default;14 15// Rep must be default initialized, not initialized with 016 17#include <chrono>18#include <cassert>19 20#include "test_macros.h"21#include "../../rep.h"22 23template <class D>24void25test()26{27 D d;28 assert(d.count() == typename D::rep());29#if TEST_STD_VER >= 1130 constexpr D d2 = D();31 static_assert(d2.count() == typename D::rep(), "");32#endif33}34 35int main(int, char**)36{37 test<std::chrono::duration<Rep> >();38 39 return 0;40}41