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