xref: /llvm-project/libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.tzdb/tzdb.members.pass.cpp (revision a4422a51941bfcffc870d1e2fff682e5387f89c2)
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 
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // UNSUPPORTED: no-filesystem, no-localization, no-tzdb
11 
12 // XFAIL: libcpp-has-no-experimental-tzdb
13 // XFAIL: availability-tzdb-missing
14 
15 // <chrono>
16 
17 //  struct tzdb {
18 //    string                 version;
19 //    vector<time_zone>      zones;
20 //    vector<time_zone_link> links;
21 //    vector<leap_second>    leap_seconds;
22 //
23 //    ...
24 //  };
25 
26 #include <chrono>
27 #include <cassert>
28 #include <concepts>
29 #include <string>
30 
31 #include "assert_macros.h"
32 
main(int,const char **)33 int main(int, const char**) {
34   std::chrono::tzdb tzdb;
35 
36   static_assert(std::same_as<decltype(tzdb.version), std::string>);
37   tzdb.version = "version";
38   assert(tzdb.version == "version");
39 
40   [[maybe_unused]] std::vector<std::chrono::time_zone>& zones          = tzdb.zones;
41   [[maybe_unused]] std::vector<std::chrono::time_zone_link>& links = tzdb.links;
42   [[maybe_unused]] std::vector<std::chrono::leap_second>& leap_seconds = tzdb.leap_seconds;
43 
44   return 0;
45 }
46