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