• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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;
14 
15 // template<class charT, class traits>
16 //   basic_ostream<charT, traits>&
17 //   operator<<(basic_ostream<charT, traits>& os, const year& y);
18 //
19 //   Effects: Inserts format(fmt, y) where fmt is "%Y" widened to charT.
20 //   If !y.ok(), appends with " is not a valid year".
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& y);
25 //
26 //   Effects: Streams y into os using the format specified by the NTCTS fmt.
27 //     fmt encoding follows the rules specified in 25.11.
28 //
29 // template<class charT, class traits, class Alloc = allocator<charT>>
30 //   basic_istream<charT, traits>&
31 //   from_stream(basic_istream<charT, traits>& is, const charT* fmt,
32 //               year& y, basic_string<charT, traits, Alloc>* abbrev = nullptr,
33 //               minutes* offset = nullptr);
34 //
35 //   Effects: Attempts to parse the input stream is into the year y using the format flags
36 //     given in the NTCTS fmt as specified in 25.12. If the parse fails to decode a valid year,
37 //     is.setstate(ios_base::failbit) shall be called and y shall not be modified. If %Z is used
38 //     and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null.
39 //     If %z (or a modified variant) is used and successfully parsed, that value will be
40 //     assigned to *offset if offset is non-null.
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 = std::chrono::year;
53 
54    std::cout << year{2018};
55 }
56