brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 880994a Raw
43 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8// UNSUPPORTED: c++03, c++11, c++14, c++179 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 m16//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 26int 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