commit be344b7833338e9a654d2e43a31ff47429e1b894
parent e46f8a4425ce0c8239d84950e1d3f02c6cb65982
Author: Chris Peterson <cpeterson@mozilla.com>
Date: Sat, 25 Oct 2025 17:36:16 +0000
Bug 1990743 - Fix C++20 build error about consteval fmt::basic_fstring. r=xpcom-reviewers,emilio
fmt::basic_format_string/basic_fstring's constructor becomes consteval when compiled with -std=c++20 and its format string must be known at compile time.
Switch this test from nsTSubstring::AppendFmt() to AppendVfmt(), which accepts a format string as a basic_string_view. AppendFmt() passes its basic_format_string to AppendVfmt() as a basic_string_view anyway, so this change effectively just inlines AppendFmt().
Differential Revision: https://phabricator.services.mozilla.com/D269927
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mozglue/tests/gtest/TestFmt.cpp b/mozglue/tests/gtest/TestFmt.cpp
@@ -58,7 +58,8 @@ TEST(Fmt, CrossCheckPrintf)
nsCString fmtFormat =
PrintfToFmtFormat(tfformat::sprint_doubles[i].format_string);
nsCString withFmt;
- withFmt.AppendFmt(fmtFormat.get(), tfformat::sprint_doubles[i].value);
+ withFmt.AppendVfmt(fmtFormat.get(), fmt::make_format_args(
+ tfformat::sprint_doubles[i].value));
SprintfBuf(bufGeckoPrintf, 1024, tfformat::sprint_doubles[i].format_string,
tfformat::sprint_doubles[i].value);
if (strcmp(bufGeckoPrintf, withFmt.get()) != 0) {