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