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 month_weekday_last;
13 // constexpr month_weekday_last(const chrono::month& m,
14 // const chrono::weekday_last& wdl) noexcept;
16 // Effects: Constructs an object of type month_weekday_last by
17 // initializing m_ with m, and wdl_ with wdl.
19 // constexpr chrono::month month() const noexcept;
20 // constexpr chrono::weekday_last weekday_last() const noexcept;
21 // constexpr bool ok() const noexcept;
25 #include <type_traits>
28 #include "test_macros.h"
32 using month
= std::chrono::month
;
33 using weekday
= std::chrono::weekday
;
34 using weekday_last
= std::chrono::weekday_last
;
35 using month_weekday_last
= std::chrono::month_weekday_last
;
37 constexpr month January
= std::chrono::January
;
38 constexpr weekday Tuesday
= std::chrono::Tuesday
;
40 ASSERT_NOEXCEPT(month_weekday_last
{January
, weekday_last
{Tuesday
}});
43 constexpr month_weekday_last mwdl1
{month
{}, weekday_last
{Tuesday
}};
44 static_assert( mwdl1
.month() == month
{}, "");
45 static_assert( mwdl1
.weekday_last() == weekday_last
{Tuesday
}, "");
46 static_assert(!mwdl1
.ok(), "");
49 constexpr month_weekday_last mwdl2
{January
, weekday_last
{weekday
{16}}};
50 static_assert( mwdl2
.month() == January
, "");
51 static_assert( mwdl2
.weekday_last() == weekday_last
{weekday
{16}}, "");
52 static_assert(!mwdl2
.ok(), "");
54 // Good month and weekday_last
55 constexpr month_weekday_last mwdl3
{January
, weekday_last
{weekday
{4}}};
56 static_assert( mwdl3
.month() == January
, "");
57 static_assert( mwdl3
.weekday_last() == weekday_last
{weekday
{4}}, "");
58 static_assert( mwdl3
.ok(), "");