From 628b69c83cf44adc55bfa4a60d93c468fc56b7cb Mon Sep 17 00:00:00 2001 From: Kjetil Olsen Lye Date: Tue, 10 Oct 2023 10:58:21 +0200 Subject: [PATCH] Casting to support {fmt} v10. Due to issues with anonymous enums, newer versions of {fmt} (v10) do not seem to handle the implicit conversion from enum value to `int`. Hence we need a cast for `fmt::format`-calls involving `Matrix::block_matrix::rows` (or `cols`) to compile. This seems to only be relevant for one part of the code. For an isolated example, see https://github.com/kjetilly/fmt_fails_with_enum --- opm/simulators/linalg/ISTLSolverEbos.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opm/simulators/linalg/ISTLSolverEbos.cpp b/opm/simulators/linalg/ISTLSolverEbos.cpp index 241df3fb0..4c3e79599 100644 --- a/opm/simulators/linalg/ISTLSolverEbos.cpp +++ b/opm/simulators/linalg/ISTLSolverEbos.cpp @@ -140,8 +140,10 @@ void FlexibleSolverInfo::create(const Matrix& matrix, if (basic_comm.size() > 1) { os << fmt::format("on MPI rank: {} ", basic_comm.rank()); } + // The static_cast of Matrix::block_type::rows is needed for fmt version 10. + // TODO: Check if the cast is still needed in future versions. os << fmt::format("blocksize: {} size: {:7d} block nonzeroes: {:9d}", - Matrix::block_type::rows, matrix.N(), matrix.nonzeroes()); + static_cast(Matrix::block_type::rows), matrix.N(), matrix.nonzeroes()); DeferredLogger local_logger; local_logger.debug(os.str()); auto global_logger = gatherDeferredLogger(local_logger, basic_comm);