• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 weekday;
13 
14 // template<class charT, class traits>
15 //   basic_ostream<charT, traits>&
16 //   operator<<(basic_ostream<charT, traits>& os, const weekday& wd);
17 //
18 //   Effects: If wd.ok() == true inserts format(os.getloc(), fmt, wd) where fmt is "%a" widened to charT.
19 //     Otherwise inserts unsigned{wd} << " is not a valid weekday".
20 //
21 // template<class charT, class traits>
22 //   basic_ostream<charT, traits>&
23 //   to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const weekday& wd);
24 //
25 //   Effects: Streams wd 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 //             weekday& wd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
32 //             minutes* offset = nullptr);
33 //
34 //   Effects: Attempts to parse the input stream is into the weekday wd using
35 //       the format flags given in the NTCTS fmt as specified in 25.12.
36 //     If the parse fails to decode a valid weekday, is.setstate(ios_- base::failbit)
37 //       shall be called and wd shall not be modified.
38 //     If %Z is used and successfully parsed, that value will be assigned
39 //       to *abbrev if abbrev is non-null.
40 //     If %z (or a modified variant) is used and successfully parsed,
41 //       that value will be assigned to *offset if offset is non-null.
42 
43 #include <chrono>
44 #include <type_traits>
45 #include <cassert>
46 #include <iostream>
47 
48 #include "test_macros.h"
49 
main(int,char **)50 int main(int, char**)
51 {
52    using weekday = std::chrono::weekday;
53 
54    std::cout << weekday{3};
55 
56   return 0;
57 }
58