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 // XFAIL: *
10 
11 // <chrono>
12 // class year_month_day;
13 
14 // template<class charT, class traits>
15 //     basic_ostream<charT, traits>&
16 //     operator<<(basic_ostream<charT, traits>& os, const year_month_day& ym);
17 //
18 // Returns: os << ym.year() << '/' << ym.month().
19 //
20 //
21 // template<class charT, class traits>
22 //     basic_ostream<charT, traits>&
23 //     to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const year_month_day& ym);
24 //
25 // Effects: Streams ym into os using the format specified by the NTCTS fmt. fmt encoding follows the rules specified in 25.11.
26 //
27 // template<class charT, class traits, class Alloc = allocator<charT>>
28 //     basic_istream<charT, traits>&
29 //   from_stream(basic_istream<charT, traits>& is, const charT* fmt,
30 //               year_month_day& ym, basic_string<charT, traits, Alloc>* abbrev = nullptr,
31 //               minutes* offset = nullptr);
32 //
33 // Effects: Attempts to parse the input stream is into the year_month_day ym using the format
34 //         flags given in the NTCTS fmt as specified in 25.12. If the parse fails to decode
35 //         a valid year_month_day, is.setstate(ios_- base::failbit) shall be called and ym shall
36 //         not be modified. If %Z is used and successfully parsed, that value will be assigned
37 //         to *abbrev if abbrev is non-null. If %z (or a modified variant) is used and
38 //         successfully parsed, that value will be assigned to *offset if offset is non-null.
39 
40 
41 
42 #include <chrono>
43 #include <type_traits>
44 #include <cassert>
45 #include <iostream>
46 
47 #include "test_macros.h"
48 
main(int,char **)49 int main(int, char**)
50 {
51     using year_month_day = std::chrono::year_month_day;
52     using year           = std::chrono::year;
53     using month          = std::chrono::month;
54     using day            = std::chrono::day;
55 
56     std::cout << year_month_day{year{2018}, month{3}, day{12}};
57 
58   return 0;
59 }
60