1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // class year_month_day;
13 // year_month_day() = default;
14 // constexpr year_month_day(const chrono::year& y, const chrono::month& m,
15 // const chrono::day& d) noexcept;
17 // Effects: Constructs an object of type year_month_day by initializing
18 // y_ with y, m_ with m, and d_ with d.
20 // constexpr chrono::year year() const noexcept;
21 // constexpr chrono::month month() const noexcept;
22 // constexpr chrono::day day() const noexcept;
23 // constexpr bool ok() const noexcept;
26 #include <type_traits>
29 #include "test_macros.h"
33 using year
= std::chrono::year
;
34 using month
= std::chrono::month
;
35 using day
= std::chrono::day
;
36 using year_month_day
= std::chrono::year_month_day
;
38 ASSERT_NOEXCEPT(year_month_day
{});
39 ASSERT_NOEXCEPT(year_month_day
{year
{1}, month
{1}, day
{1}});
41 constexpr month January
= std::chrono::January
;
43 constexpr year_month_day ym0
{};
44 static_assert( ym0
.year() == year
{}, "");
45 static_assert( ym0
.month() == month
{}, "");
46 static_assert( ym0
.day() == day
{}, "");
47 static_assert(!ym0
.ok(), "");
49 constexpr year_month_day ym1
{year
{2019}, January
, day
{12}};
50 static_assert( ym1
.year() == year
{2019}, "");
51 static_assert( ym1
.month() == January
, "");
52 static_assert( ym1
.day() == day
{12}, "");
53 static_assert( ym1
.ok(), "");