| 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 |
|
| 9 |
// <chrono> |
| 10 |
|
| 11 |
// duration_values::zero // noexcept after C++17 |
| 12 |
|
| 13 |
#include <chrono> |
| 14 |
#include <cassert> |
| 15 |
|
| 16 |
#include "test_macros.h" |
| 17 |
#include "../../rep.h" |
| 18 |
|
| 19 |
int main(int, char**) |
| 20 |
{ |
| 21 |
assert(std::chrono::duration_values<int>::zero() == 0); |
| 22 |
assert(std::chrono::duration_values<Rep>::zero() == 0); |
| 23 |
#if TEST_STD_VER >= 11 |
| 24 |
static_assert(std::chrono::duration_values<int>::zero() == 0, ""); |
| 25 |
static_assert(std::chrono::duration_values<Rep>::zero() == 0, ""); |
| 26 |
#endif |
| 27 |
|
| 28 |
LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<int>::zero()); |
| 29 |
LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::zero()); |
| 30 |
#if TEST_STD_VER > 17 |
| 31 |
ASSERT_NOEXCEPT(std::chrono::duration_values<int>::zero()); |
| 32 |
ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::zero()); |
| 33 |
#endif |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |