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_weekday;
12 // month_weekday represents the nth weekday of a month, of an as yet unspecified year.
13
14 // constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept;
15 // Effects: Constructs an object of type month_weekday by initializing m_ with m, and wdi_ with wdi.
16 //
17 // constexpr chrono::month month() const noexcept;
18 // constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
19 // constexpr bool ok() const noexcept;
20
21 #include <chrono>
22 #include <type_traits>
23 #include <cassert>
24
25 #include "test_macros.h"
26
main(int,char **)27 int main(int, char**)
28 {
29 using month_weekday = std::chrono::month_weekday;
30 using month = std::chrono::month;
31 using weekday = std::chrono::weekday;
32 using weekday_indexed = std::chrono::weekday_indexed;
33
34 ASSERT_NOEXCEPT(month_weekday{month{1}, weekday_indexed{weekday{}, 1}});
35
36 constexpr month_weekday md0{month{}, weekday_indexed{}};
37 static_assert( md0.month() == month{}, "");
38 static_assert( md0.weekday_indexed() == weekday_indexed{}, "");
39 static_assert(!md0.ok(), "");
40
41 constexpr month_weekday md1{std::chrono::January, weekday_indexed{std::chrono::Friday, 4}};
42 static_assert( md1.month() == std::chrono::January, "");
43 static_assert( md1.weekday_indexed() == weekday_indexed{std::chrono::Friday, 4}, "");
44 static_assert( md1.ok(), "");
45
46 return 0;
47 }
48