xref: /llvm-project/libcxx/test/std/time/time.clock/time.clock.utc/leap_second_info.members.pass.cpp (revision 0cd794d4860e376698bb4da24bcdf8cbf331835c)
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 leap_second_info {
18 //   bool    is_leap_second;
19 //   seconds elapsed;
20 // };
21 
22 #include <chrono>
23 #include <type_traits>
24 
25 // Validates whether:
26 // - The members are present as non-const members.
27 // - The struct is an aggregate.
28 int main(int, const char**) {
29   static_assert(std::is_aggregate_v<std::chrono::leap_second_info>);
30 
31   std::chrono::leap_second_info leap_second_info{.is_leap_second = false, .elapsed = std::chrono::seconds(0)};
32 
33   [[maybe_unused]] bool& is_leap_second          = leap_second_info.is_leap_second;
34   [[maybe_unused]] std::chrono::seconds& elapsed = leap_second_info.elapsed;
35 
36   return 0;
37 }
38