git: c176200cab58 - main - math/cado-nfs: fix a few fmt const[expr]-ness bugs

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Sun, 10 Aug 2025 19:03:28 UTC
The branch main has been updated by mandree:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c176200cab58b0450b9f7c349009bba2462b8629

commit c176200cab58b0450b9f7c349009bba2462b8629
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2025-08-09 15:30:06 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2025-08-10 19:02:45 +0000

    math/cado-nfs: fix a few fmt const[expr]-ness bugs
    
    This should fix the build of main software and tests with
    upcoming fmt 11.2.0.
    
    PR:             286864
    Reported by:    diizzy@
    Approved by:    maintainer timeout (yuri@, 82 days)
---
 .../patch-linalg_bwc_lingen__call__companion.hpp   | 11 +++++++++
 .../files/patch-tests_sieve_test__fb__root.cpp     | 26 ++++++++++++++++++++++
 math/cado-nfs/files/patch-utils_cxx__mpz.hpp       | 14 ++++++++++++
 3 files changed, 51 insertions(+)

diff --git a/math/cado-nfs/files/patch-linalg_bwc_lingen__call__companion.hpp b/math/cado-nfs/files/patch-linalg_bwc_lingen__call__companion.hpp
new file mode 100644
index 000000000000..7522f8d3b07e
--- /dev/null
+++ b/math/cado-nfs/files/patch-linalg_bwc_lingen__call__companion.hpp
@@ -0,0 +1,11 @@
+--- linalg/bwc/lingen_call_companion.hpp.orig	2024-04-08 11:23:28 UTC
++++ linalg/bwc/lingen_call_companion.hpp
+@@ -177,7 +177,7 @@ namespace fmt {
+     // c++-14 or later
+     auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) { return ctx.begin(); }
+     template <typename FormatContext>
+-auto format(lingen_call_companion::key const & c, FormatContext& ctx) -> decltype(ctx.out()) {
++        auto format(lingen_call_companion::key const & c, FormatContext& ctx) const -> decltype(ctx.out()) {
+             std::ostringstream os;
+             os << c;
+             return formatter<string_view>::format( string_view(os.str()), ctx);
diff --git a/math/cado-nfs/files/patch-tests_sieve_test__fb__root.cpp b/math/cado-nfs/files/patch-tests_sieve_test__fb__root.cpp
new file mode 100644
index 000000000000..dfb184a7704f
--- /dev/null
+++ b/math/cado-nfs/files/patch-tests_sieve_test__fb__root.cpp
@@ -0,0 +1,26 @@
+--- tests/sieve/test_fb_root.cpp.orig	2024-04-08 11:23:28 UTC
++++ tests/sieve/test_fb_root.cpp
+@@ -57,9 +57,9 @@ template <typename T> struct /* fmt:: */ formatter<fb_
+     // only allow {} for formatting. No :, no :x, etc. It could be nice
+     // to allow them, though. Note that this should be constexpr with
+     // c++-14 or later
+-    auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) { return ctx.begin(); }
++    constexpr auto parse(format_parse_context& ctx) const -> decltype(ctx.begin()) { return ctx.begin(); }
+     template <typename FormatContext>
+-        auto format(fb_root_p1_t<T> const & c, FormatContext& ctx) -> decltype(ctx.out()) {
++        auto format(fb_root_p1_t<T> const & c, FormatContext& ctx) const -> decltype(ctx.out()) {
+             std::ostringstream os;
+             os << c;
+             return formatter<string_view>::format( string_view(os.str()), ctx);
+@@ -70,9 +70,9 @@ template <> struct /* fmt:: */ formatter<qlattice_basi
+     // only allow {} for formatting. No :, no :x, etc. It could be nice
+     // to allow them, though. Note that this should be constexpr with
+     // c++-14 or later
+-    auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) { return ctx.begin(); }
++    constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) { return ctx.begin(); }
+     template <typename FormatContext>
+-        auto format(qlattice_basis const & c, FormatContext& ctx) -> decltype(ctx.out()) {
++        auto format(qlattice_basis const & c, FormatContext& ctx) const -> decltype(ctx.out()) {
+             std::ostringstream os;
+             os << c;
+             return formatter<string_view>::format( string_view(os.str()), ctx);
diff --git a/math/cado-nfs/files/patch-utils_cxx__mpz.hpp b/math/cado-nfs/files/patch-utils_cxx__mpz.hpp
new file mode 100644
index 000000000000..028f18381353
--- /dev/null
+++ b/math/cado-nfs/files/patch-utils_cxx__mpz.hpp
@@ -0,0 +1,14 @@
+--- utils/cxx_mpz.hpp.orig	2024-04-08 11:23:28 UTC
++++ utils/cxx_mpz.hpp
+@@ -234,9 +234,9 @@ namespace fmt {
+     // only allow {} for formatting. No :, no :x, etc. It could be nice
+     // to allow them, though. Note that this should be constexpr with
+     // c++-14 or later
+-    auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) { return ctx.begin(); }
++    auto parse(format_parse_context& ctx) const -> decltype(ctx.begin()) { return ctx.begin(); }
+     template <typename FormatContext>
+-auto format(cxx_mpz const & c, FormatContext& ctx) -> decltype(ctx.out()) {
++    auto format(cxx_mpz const & c, FormatContext& ctx) const -> decltype(ctx.out()) {
+             std::ostringstream os;
+             os << c;
+             return formatter<string_view>::format( string_view(os.str()), ctx);