llvm-project/libcxx/test/libcxx/diagnostics/chrono.nodiscard_extensions.compile.pass.cpp
Mark de Wever d332d88b91
[libc++][chrono] Loads tzdata.zi in tzdb. (#74928)
This implements the loading of the tzdata.zi file and store its contents
in the tzdb struct.

This adds all required members except:
- the leap seconds,
- the locate_zone, and
- current_zone.

The class time_zone is incomplete and only contains the parts needed for
storing the parsed data.

The class time_zone_link is fully implemented including its non-member
functions.

Implements parts of:
- P0355 Extending <chrono> to Calendars and Time Zones
- P1614 The Mothership has Landed

Implements:
- P1982 Rename link to time_zone_link
2024-02-17 14:28:01 +01:00

55 lines
1.3 KiB
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Check that format functions aren't marked [[nodiscard]] when
// _LIBCPP_DISABLE_NODISCARD_EXT is defined
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
// XFAIL: libcpp-has-no-incomplete-tzdb
// XFAIL: availability-tzdb-missing
// <chrono>
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_EXT
#include <chrono>
#include "test_macros.h"
// These types have "private" constructors.
extern std::chrono::time_zone tz;
extern std::chrono::time_zone_link link;
void test() {
std::chrono::tzdb_list& list = std::chrono::get_tzdb_list();
list.front();
list.begin();
list.end();
list.cbegin();
list.cend();
std::chrono::get_tzdb_list();
std::chrono::get_tzdb();
std::chrono::remote_version();
{
tz.name();
operator==(tz, tz);
operator<=>(tz, tz);
}
{
link.name();
link.target();
operator==(link, link);
operator<=>(link, link);
}
}