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