Skip to content

Switch to C++20#3265

Open
dschwoerer wants to merge 7 commits intonextfrom
c++20
Open

Switch to C++20#3265
dschwoerer wants to merge 7 commits intonextfrom
c++20

Conversation

@dschwoerer
Copy link
Contributor

Includes #3264

Mostly for testing and discussion.

@dschwoerer dschwoerer added discussion build-system issues with make/configure/... labels Feb 3, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

dschwoerer and others added 7 commits February 27, 2026 09:45
Otherwise fmt tries to do compile-time checks, but fails as it cannot be
checked at compile time.
fmtlib/fmt#4179
With C++ std::accumulate uses std::move, which fails with the reference.
isatty is provided by both cpptrace and unistd.h, so we should only
include one.
Mostly involves using `fmt::vformat` with `fmt::make_format_args` in
functions/ctors that act like `fmt::format`.

Note that `fmt::make_format_args` requires lvalues, so although we take `Args&&`
we _must not_ call `std::forward`.

We also have to introduce a new gettext macro `_f` to allow compile-time format
arg checking _and_ runtime i18n substitution.
Copy link
Member

@ZedThree ZedThree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a few years we can move to C++23 :)

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

template <class... Args>
// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward)
MsgStackItem(const std::string& file, int line, fmt::format_string<Args...> msg,
Args&&... args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: forwarding reference parameter 'args' is never forwarded inside the function body [cppcoreguidelines-missing-std-forward]

               Args&&... args)
                         ^

mpi->MPI_Irecv(buffer, size, PVEC_REAL_MPI_TYPE, proc, tag,
BoutComm::get(), ch->request);
mpi->MPI_Irecv(buffer, size, PVEC_REAL_MPI_TYPE, proc, tag, BoutComm::get(),
ch->request);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]

                 ch->request);
                 ^

mpi->MPI_Irecv(buffer, size, PVEC_REAL_MPI_TYPE, proc, tag,
BoutComm::get(), ch->request);
mpi->MPI_Irecv(buffer, size, PVEC_REAL_MPI_TYPE, proc, tag, BoutComm::get(),
ch->request);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]

                 ch->request);
                 ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-system issues with make/configure/... discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants