| 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 year_month_day_last; |
| 12 |
|
| 13 |
// constexpr year_month_day_last(const chrono::year& y, |
| 14 |
// const chrono::month_day_last& mdl) noexcept; |
| 15 |
// |
| 16 |
// Effects: Constructs an object of type year_month_day_last by initializing |
| 17 |
// initializing y_ with y and mdl_ with mdl. |
| 18 |
// |
| 19 |
// constexpr chrono::year year() const noexcept; |
| 20 |
// constexpr chrono::month month() const noexcept; |
| 21 |
// constexpr chrono::month_day_last month_day_last() const noexcept; |
| 22 |
// constexpr bool ok() const noexcept; |
| 23 |
|
| 24 |
#include <chrono> |
| 25 |
#include <type_traits> |
| 26 |
#include <cassert> |
| 27 |
|
| 28 |
#include "test_macros.h" |
| 29 |
|
| 30 |
int main(int, char**) |
| 31 |
{ |
| 32 |
using year = std::chrono::year; |
| 33 |
using month = std::chrono::month; |
| 34 |
using month_day_last = std::chrono::month_day_last; |
| 35 |
using year_month_day_last = std::chrono::year_month_day_last; |
| 36 |
|
| 37 |
ASSERT_NOEXCEPT(year_month_day_last{year{1}, month_day_last{month{1}}}); |
| 38 |
|
| 39 |
constexpr month January = std::chrono::January; |
| 40 |
|
| 41 |
constexpr year_month_day_last ymdl0{year{}, month_day_last{month{}}}; |
| 42 |
static_assert( ymdl0.year() == year{}, ""); |
| 43 |
static_assert( ymdl0.month() == month{}, ""); |
| 44 |
static_assert( ymdl0.month_day_last() == month_day_last{month{}}, ""); |
| 45 |
static_assert(!ymdl0.ok(), ""); |
| 46 |
|
| 47 |
constexpr year_month_day_last ymdl1{year{2019}, month_day_last{January}}; |
| 48 |
static_assert( ymdl1.year() == year{2019}, ""); |
| 49 |
static_assert( ymdl1.month() == January, ""); |
| 50 |
static_assert( ymdl1.month_day_last() == month_day_last{January}, ""); |
| 51 |
static_assert( ymdl1.ok(), ""); |
| 52 |
|
| 53 |
return 0; |
| 54 |
} |