GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++

libstdc++: Fix chrono feature macro for old-ABI-only builds

Ensures the C++20 chrono time zone API is correctly indicated for old-ABI-only builds.

This commit corrects the behavior of the __cpp_lib_chrono feature test macro for libstdc++ builds that exclusively use the old ABI. Previously, these builds would report the C++17 value for __cpp_lib_chrono even though they included the C++20 chrono time zone API. The fix adjusts the conditions under which the C++20 value (201907L) is defined to include old-ABI-only builds, and modifies headers to check __cpp_lib_chrono directly, ensuring accurate feature reporting.

In Details

This change rectifies an inconsistency in libstdc++ where old-ABI-only builds (i.e., !_GLIBCXX_USE_CXX11_ABI && !_GLIBCXX_USE_DUAL_ABI) incorrectly reported __cpp_lib_chrono as C++17, despite providing the C++20 time zone APIs. The fix involves widening the condition for the C++20 value of __cpp_lib_chrono to include these old-ABI-only configurations and ensuring that headers query __cpp_lib_chrono directly rather than duplicating ABI checks. This ensures correct feature detection for C++20 chrono features in all build configurations.

For Context
__cpp_lib_chrono
A C++ feature test macro that indicates the availability of C++20 chrono library features, including time zone support.
ABI
Application Binary Interface. Defines how low-level code (like compiled C++ libraries) interfaces with the operating system and other code. Changes to the ABI can break compatibility between different compiler versions or build configurations.
old-ABI-only build
A build configuration of libstdc++ that exclusively uses the older Application Binary Interface, not supporting the C++11 ABI or dual-ABI features.
chrono time zone API
The C++20 standard library components within the <chrono> header that provide support for time zone conversions and handling.
Filed Under: libstdc++c++20chronoabibugfix