[PATCH gcc-15 1/1] libstdc++: avoid bf16 literal in format arg normalization

Jakit Liang jakitliang@gmail.com
Sat Sep 5 21:08:49 GMT 2026


In std::basic_format_arg::_S_to_arg_type, replace the bfloat16 normalization check with __gnu_cxx::__bfloat16_t.

This preserves normalization to float while avoiding a direct bf16 literal-based type check in <format>.

Signed-off-by: Jakit Liang <jakitliang@gmail.com>
---
 libstdc++-v3/include/std/format | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 68ad367bda5..f4efbd393c9 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -3859,7 +3859,7 @@ namespace __format
 #endif
 
 #if defined(__BFLT16_DIG__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
-	  else if constexpr (is_same_v<_Td, decltype(0.0bf16)>)
+	  else if constexpr (is_same_v<_Td, __gnu_cxx::__bfloat16_t>)
 	    return type_identity<float>();
 #endif
 
-- 
2.47.3



More information about the Libstdc++ mailing list