| 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 |
// UNSUPPORTED: c++03, c++11, c++14, c++17 |
| 9 |
|
| 10 |
// <chrono> |
| 11 |
// class month_day; |
| 12 |
|
| 13 |
// month_day() = default; |
| 14 |
// constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept; |
| 15 |
// |
| 16 |
// Effects: Constructs an object of type month_day by initializing m_ with m, and d_ with d. |
| 17 |
// |
| 18 |
// constexpr chrono::month month() const noexcept; |
| 19 |
// constexpr chrono::day day() const noexcept; |
| 20 |
// constexpr bool ok() const noexcept; |
| 21 |
|
| 22 |
#include <chrono> |
| 23 |
#include <type_traits> |
| 24 |
#include <cassert> |
| 25 |
|
| 26 |
#include "test_macros.h" |
| 27 |
|
| 28 |
int main(int, char**) |
| 29 |
{ |
| 30 |
using day = std::chrono::day; |
| 31 |
using month = std::chrono::month; |
| 32 |
using month_day = std::chrono::month_day; |
| 33 |
|
| 34 |
ASSERT_NOEXCEPT(month_day{}); |
| 35 |
ASSERT_NOEXCEPT(month_day{month{1}, day{1}}); |
| 36 |
|
| 37 |
constexpr month_day md0{}; |
| 38 |
static_assert( md0.month() == month{}, ""); |
| 39 |
static_assert( md0.day() == day{}, ""); |
| 40 |
static_assert(!md0.ok(), ""); |
| 41 |
|
| 42 |
constexpr month_day md1{std::chrono::January, day{4}}; |
| 43 |
static_assert( md1.month() == std::chrono::January, ""); |
| 44 |
static_assert( md1.day() == day{4}, ""); |
| 45 |
static_assert( md1.ok(), ""); |
| 46 |
|
| 47 |
return 0; |
| 48 |
} |