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