]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: add a workaround for format_kind<optional<T>> [PR120644]
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Fri, 13 Jun 2025 09:38:23 +0000 (11:38 +0200)
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Fri, 13 Jun 2025 13:20:18 +0000 (15:20 +0200)
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`.

libstdc++-v3/include/std/optional

index 2ae71f11e21350874c4a758d4634be845ec471e0..cc7af5bbd7d2c331227182f5560b5d110472e25f 100644 (file)
@@ -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