1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
10
11 // <chrono>
12 // class year_month_day_last;
13
14 // constexpr year_month_day_last(const chrono::year& y,
15 // const chrono::month_day_last& mdl) noexcept;
16 //
17 // Effects: Constructs an object of type year_month_day_last by initializing
18 // initializing y_ with y and mdl_ with mdl.
19 //
20 // constexpr chrono::year year() const noexcept;
21 // constexpr chrono::month month() const noexcept;
22 // constexpr chrono::month_day_last month_day_last() const noexcept;
23 // constexpr bool ok() const noexcept;
24
25 #include <chrono>
26 #include <type_traits>
27 #include <cassert>
28
29 #include "test_macros.h"
30
main()31 int main()
32 {
33 using year = std::chrono::year;
34 using month = std::chrono::month;
35 using month_day_last = std::chrono::month_day_last;
36 using year_month_day_last = std::chrono::year_month_day_last;
37
38 ASSERT_NOEXCEPT(year_month_day_last{year{1}, month_day_last{month{1}}});
39
40 constexpr month January = std::chrono::January;
41
42 constexpr year_month_day_last ymdl0{year{}, month_day_last{month{}}};
43 static_assert( ymdl0.year() == year{}, "");
44 static_assert( ymdl0.month() == month{}, "");
45 static_assert( ymdl0.month_day_last() == month_day_last{month{}}, "");
46 static_assert(!ymdl0.ok(), "");
47
48 constexpr year_month_day_last ymdl1{year{2019}, month_day_last{January}};
49 static_assert( ymdl1.year() == year{2019}, "");
50 static_assert( ymdl1.month() == January, "");
51 static_assert( ymdl1.month_day_last() == month_day_last{January}, "");
52 static_assert( ymdl1.ok(), "");
53 }
54