libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

ctor.pass.cpp (1270B)


      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_last;
     13 
     14 //  constexpr month_day_last(const chrono::month& m) noexcept;
     15 //
     16 //  Effects:  Constructs an object of type month_day_last by initializing m_ with m
     17 //
     18 //  constexpr chrono::month month() 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 
     27 int main()
     28 {
     29     using month     = std::chrono::month;
     30     using month_day_last = std::chrono::month_day_last;
     31 
     32     ASSERT_NOEXCEPT(month_day_last{month{1}});
     33 
     34     constexpr month_day_last md0{month{}};
     35     static_assert( md0.month() == month{}, "");
     36     static_assert(!md0.ok(),               "");
     37 
     38     constexpr month_day_last md1{std::chrono::January};
     39     static_assert( md1.month() == std::chrono::January, "");
     40     static_assert( md1.ok(),                            "");
     41 }