[gcc r15-3269] libstdc++: Fix -Wunused-variable warning in <format>
Jonathan Wakely
redi@gcc.gnu.org
Wed Aug 28 20:41:13 GMT 2024
https://gcc.gnu.org/g:0e2b3dba5179c9becbff0730febbdce3a088bae3
commit r15-3269-g0e2b3dba5179c9becbff0730febbdce3a088bae3
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Aug 28 12:09:58 2024 +0100
libstdc++: Fix -Wunused-variable warning in <format>
libstdc++-v3/ChangeLog:
* include/std/format (format_parse_context::check_dynamic_spec):
Add [[maybe_unused]] attribute and comment.
Diff:
---
libstdc++-v3/include/std/format | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 3280dadfb90e..52243eb54792 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -4323,6 +4323,11 @@ namespace __format
constexpr void
basic_format_parse_context<_CharT>::check_dynamic_spec(size_t __id) noexcept
{
+ // This call enforces the Mandates: condition that _Ts contains valid
+ // types and each type appears at most once. It could be a static_assert
+ // but this way failures give better diagnostics, due to calling the
+ // non-constexpr __invalid_dynamic_spec function.
+ [[maybe_unused]]
constexpr bool __ok = __check_dynamic_spec_types<_Ts...>();
if consteval {
More information about the Libstdc++-cvs
mailing list