aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-08-28 12:09:58 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-08-28 21:34:22 +0100
commit0e2b3dba5179c9becbff0730febbdce3a088bae3 (patch)
tree44f54f89886059fb1faea531b6c2f34b430a2061
parenta59f1cc31cf6c7ed30a78cef134ea3ed5e139414 (diff)
downloadgcc-0e2b3dba5179c9becbff0730febbdce3a088bae3.zip
gcc-0e2b3dba5179c9becbff0730febbdce3a088bae3.tar.gz
gcc-0e2b3dba5179c9becbff0730febbdce3a088bae3.tar.bz2
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.
-rw-r--r--libstdc++-v3/include/std/format5
1 files changed, 5 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 3280dad..52243eb 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 {