• 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 // UNSUPPORTED: clang-5, clang-6, clang-7
11 // UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9, apple-clang-10
12 
13 // <chrono>
14 // class year;
15 
16 // constexpr year operator""y(unsigned long long y) noexcept;
17 
18 #include <chrono>
19 #include <type_traits>
20 #include <cassert>
21 
22 #include "test_macros.h"
23 
main()24 int main()
25 {
26     {
27     using namespace std::chrono;
28     ASSERT_NOEXCEPT(4y);
29 
30     static_assert( 2017y == year(2017), "");
31     year y1 = 2018y;
32     assert (y1 == year(2018));
33     }
34 
35     {
36     using namespace std::literals;
37     ASSERT_NOEXCEPT(4d);
38 
39     static_assert( 2017y == std::chrono::year(2017), "");
40 
41     std::chrono::year y1 = 2020y;
42     assert (y1 == std::chrono::year(2020));
43     }
44 }
45