[lld/COFF] Demangle symbol name in discarded section relocation error message (#119726)
[llvm-project.git] / libcxx / test / std / time / time.zone / time.zone.zonedtime / time.zone.zonedtime.ctor / zoned_time_duration2.pass.cpp
blob5a61b3ce4d185f00ae7f352d9b93186a550e168b
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // UNSUPPORTED: no-filesystem, no-localization, no-tzdb
12 // XFAIL: libcpp-has-no-experimental-tzdb
13 // XFAIL: availability-tzdb-missing
15 // <chrono>
17 // template<class Duration, class TimeZonePtr = const time_zone*>
18 // class zoned_time;
20 // template<class Duration2>
21 // zoned_time(const zoned_time<Duration2, TimeZonePtr>& y);
23 #include <chrono>
24 #include <concepts>
25 #include <cassert>
27 namespace cr = std::chrono;
29 int main(int, char**) {
30 // is_convertible_v<sys_time<Duration2>, sys_time<Duration>> is true.
32 using duration = cr::microseconds;
33 using time_point = cr::sys_time<duration>;
34 cr::zoned_time<duration> zt{time_point{duration{42}}};
36 using duration2 = cr::nanoseconds;
37 using time_point2 = cr::sys_time<duration2>;
38 static_assert(std::constructible_from<cr::zoned_time<duration2>, cr::zoned_time<duration>>);
39 cr::zoned_time<duration2> zt2{zt};
41 assert(zt2.get_sys_time() == time_point2{duration2{42'000}});
44 using duration = cr::milliseconds;
45 using time_point = cr::sys_time<duration>;
46 cr::zoned_time<duration> zt{time_point{duration{42}}};
48 using duration2 = cr::nanoseconds;
49 using time_point2 = cr::sys_time<duration2>;
50 static_assert(std::constructible_from<cr::zoned_time<duration2>, cr::zoned_time<duration>>);
51 cr::zoned_time<duration2> zt2{zt};
53 assert(zt2.get_sys_time() == time_point2{duration2{42'000'000}});
56 using duration = cr::seconds;
57 using time_point = cr::sys_time<duration>;
58 cr::zoned_time<duration> zt{time_point{duration{42}}};
60 using duration2 = cr::nanoseconds;
61 using time_point2 = cr::sys_time<duration2>;
62 static_assert(std::constructible_from<cr::zoned_time<duration2>, cr::zoned_time<duration>>);
63 cr::zoned_time<duration2> zt2{zt};
65 assert(zt2.get_sys_time() == time_point2{duration2{42'000'000'000}});
67 // is_convertible_v<sys_time<Duration2>, sys_time<Duration>> is false.
69 using duration = cr::milliseconds;
71 using duration2 = cr::seconds;
72 static_assert(!std::constructible_from<cr::zoned_time<duration2>, cr::zoned_time<duration>>);
75 using duration = cr::microseconds;
77 using duration2 = cr::seconds;
78 static_assert(!std::constructible_from<cr::zoned_time<duration2>, cr::zoned_time<duration>>);
81 using duration = cr::nanoseconds;
83 using duration2 = cr::seconds;
84 static_assert(!std::constructible_from<cr::zoned_time<duration2>, cr::zoned_time<duration>>);
87 return 0;