diff mbox series

[committed,2/2] libstdc++: Fix -Wunused-variable warning in <format>

Message ID 20240828204151.1861983-1-jwakely@redhat.com
State New
Headers show
Series [committed,1/2] libstdc++: Remove unused typedef in <ranges> | expand

Commit Message

Jonathan Wakely Aug. 28, 2024, 8:41 p.m. UTC
Tested x86_64-linux. Pushed to trunk.

-- >8 --

libstdc++-v3/ChangeLog:

	* include/std/format (format_parse_context::check_dynamic_spec):
	Add [[maybe_unused]] attribute and comment.
---
 libstdc++-v3/include/std/format | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 3280dadfb90..52243eb5479 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 {