| 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 | |
| 11 | // XFAIL: libcpp-has-no-experimental-tzdb |
| 12 | |
| 13 | // <chrono> |
| 14 | |
| 15 | // struct sys_info { |
| 16 | // sys_seconds begin; |
| 17 | // sys_seconds end; |
| 18 | // seconds offset; |
| 19 | // minutes save; |
| 20 | // string abbrev; |
| 21 | // }; |
| 22 | |
| 23 | // Validates whether: |
| 24 | // - The members are present as non-const members. |
| 25 | // - The struct is an aggregate. |
| 26 | |
| 27 | #include <chrono> |
| 28 | #include <string> |
| 29 | #include <type_traits> |
| 30 | |
| 31 | int main(int, char**) { |
| 32 | static_assert(std::is_aggregate_v<std::chrono::sys_info>); |
| 33 | |
| 34 | std::chrono::sys_info sys_info{ |
| 35 | .begin = std::chrono::sys_seconds::min(), |
| 36 | .end = std::chrono::sys_seconds::max(), |
| 37 | .offset = std::chrono::seconds(0), |
| 38 | .save = std::chrono::minutes(0), |
| 39 | .abbrev = "UTC" }; |
| 40 | |
| 41 | [[maybe_unused]] std::chrono::sys_seconds& begin = sys_info.begin; |
| 42 | [[maybe_unused]] std::chrono::sys_seconds& end = sys_info.end; |
| 43 | [[maybe_unused]] std::chrono::seconds& offset = sys_info.offset; |
| 44 | [[maybe_unused]] std::chrono::minutes& save = sys_info.save; |
| 45 | [[maybe_unused]] std::string& abbrev = sys_info.abbrev; |
| 46 | |
| 47 | return 0; |
| 48 | } |
| 49 | |