]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix -Wunused-but-set-variable in std::format_to test
authorJonathan Wakely <jwakely@redhat.com>
Thu, 24 Aug 2023 10:42:17 +0000 (11:42 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 24 Aug 2023 12:44:38 +0000 (13:44 +0100)
libstdc++-v3/ChangeLog:

* testsuite/std/format/functions/format_to.cc: Avoid warning for
unused variables.

libstdc++-v3/testsuite/std/format/functions/format_to.cc

index a35568954e2c3ee84b7877ccd0c01c997187c64a..c5c3c503625c3abd68420b9410df73f715d5a3d4 100644 (file)
@@ -69,14 +69,14 @@ test_move_only()
 {
   std::string str;
   move_only_iterator mo(std::back_inserter(str));
-  auto res = std::format_to(std::move(mo), "for{:.3} that{:c}",
-                                    "matte", (int)'!');
+  [[maybe_unused]] auto res
+    = std::format_to(std::move(mo), "for{:.3} that{:c}", "matte", (int)'!');
   VERIFY( str == "format that!" );
 
   std::vector<wchar_t> vec;
   move_only_iterator wmo(std::back_inserter(vec));
-  auto wres = std::format_to(std::move(wmo), L"for{:.3} hat{:c}",
-                                      L"matte", (long)L'!');
+  [[maybe_unused]] auto wres
+    = std::format_to(std::move(wmo), L"for{:.3} hat{:c}", L"matte", (long)L'!');
   VERIFY( std::wstring_view(vec.data(), vec.size()) == L"format hat!" );
 }