Hi, Attached is a workaround for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120644It looks it's a C++ frontend bug, this commit just silences the regression in the modules testsuite that have been observed after the introduction of range support for optional in r16-1487-g774ae8734f0e19. The semantic of the code is otherwise equivalent -- the underlying bug is not addressed by this.
Thank you, -- Giuseppe D'Angelo
From 2e9da102644c9f74b120e9f4504562ab7a19df8f Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo <giuseppe.dang...@kdab.com> Date: Fri, 13 Jun 2025 11:38:23 +0200 Subject: [PATCH] libstdc++: add a workaround for format_kind<optional<T>> [PR120644] The specialization of format_kind for optional is causing a problem when optional is imported and included. The comments on the PR strongly suggest that this is a frontend bug; this commit just works around the issue by specifying the type of format_kind<optional<T>> to be `range_format`, rather than leaving the compiler deduce it via `auto`. PR c++/120644 libstdc++-v3/ChangeLog: * include/std/optional (format_kind): Do not use `auto`. Signed-off-by: Giuseppe D'Angelo <giuseppe.dang...@kdab.com> --- libstdc++-v3/include/std/optional | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 2ae71f11e21..cc7af5bbd7d 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -1815,7 +1815,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ranges::enable_view<optional<_Tp>> = true; template<typename _Tp> - inline constexpr auto + inline constexpr range_format format_kind<optional<_Tp>> = range_format::disabled; #endif // __cpp_lib_optional_range_support -- 2.43.0
smime.p7s
Description: S/MIME Cryptographic Signature