The correct fix would be to set __cpp_lib_chrono == 201803 when all
the types are defined.

On Wed, 30 Sept 2026 at 14:41, Jonathan Wakely <[email protected]> wrote:
>
> P.S. patches for libstdc++ need to be sent to the gcc-patches list, as
> for all patches to GCC code. I've CC'd that list now.
>
> On Wed, 30 Sept 2026 at 14:34, Jonathan Wakely <[email protected]> wrote:
> >
> > On Wed, 30 Sept 2026 at 14:28, Jonathan Wakely <[email protected]> wrote:
> > >
> > > On Wed, 30 Sept 2026 at 14:21, <[email protected]> wrote:
> > > >
> > > > From: Hugo Beauzée-Luyssen <[email protected]>
> > > >
> > > > <chrono> gates its <string>/<vector>/<sstream>/shared_ptr/unique_ptr
> > > > includes on __cpp_lib_chrono >= 201803L, which bits/version.h only
> > > > defines when _GLIBCXX_USE_CXX11_ABI is set. But the actual
> > > > chrono::tzdb/time_zone declarations further down the header are
> > > > gated on the broader _GLIBCXX_HOSTED && (_GLIBCXX_USE_CXX11_ABI ||
> > > > !_GLIBCXX_USE_DUAL_ABI), deliberately kept available for old-ABI-only
> > > > builds.
> > > >
> > > > libstdc++-v3/ChangeLog:
> > > >
> > > >         * include/std/chrono: Fix missing headers when building for the
> > > >           old ABI
> > > >
> > > > Assisted-by: Claude (claude-sonnet-5)
> > > > Signed-off-by: Hugo Beauzée-Luyssen <[email protected]>
> > > > ---
> > > >  libstdc++-v3/include/std/chrono | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/libstdc++-v3/include/std/chrono 
> > > > b/libstdc++-v3/include/std/chrono
> > > > index 4116f1c815e..82402045e6f 100644
> > > > --- a/libstdc++-v3/include/std/chrono
> > > > +++ b/libstdc++-v3/include/std/chrono
> > > > @@ -57,7 +57,8 @@
> > > >  # include <bits/stl_algo.h>     // upper_bound
> > > >  # include <bits/range_access.h> // begin/end for arrays
> > > >  #endif
> > > > -#if __cpp_lib_chrono >= 201803L // C++20 && HOSTED && USE_CXX11_ABI
> > > > +#if __cpp_lib_chrono >= 201803L \
> > > > +    || (defined __glibcxx_chrono_cxx20 && _GLIBCXX_HOSTED && 
> > > > !_GLIBCXX_USE_DUAL_ABI)
> > >
> > > This seems unnecessarily complicated.
> > >
> > > Why not just:
> > >
> > > #if defined __glibcxx_chrono_cxx20 && _GLIBCXX_HOSTED
> > >
> > > Doesn't that cover both cases?
> >
> > Worst case, we include some unnecessary headers for the old-ABI case
> > in a dual-ABI build.
> >
> > >
> > >
> > > >  # include <sstream>
> > > >  # include <string>
> > > >  # include <vector>
> > > > --
> > > > 2.43.0
> > > >
> > > >

Reply via email to