C++20 support in the codebase


Our code base currently compiles as C++17 as we have decided not to bump the standard and subsequently the required compiler versions for 2024 release. By setting CMAKE_CXX_STANDARD to 20 in CMakeLists.txt, one can easily see that GROMACS can not at the moment be compiled as C++20.

I believe that it would be useful to be able to compile the code as C++20 (in addition to C++17) right now as it would allow us to use the new language and standard library features in the non-public (or not-yet-public) code extensions. Furthermore, the code that is developed for the future contributions and not expected to be merged in the near-term release can then also use the C++20 features.

The required changes for the code to be compileable as both C++17 and 20 are not major: Draft: First attempt at C++20 compatibility (!3871) · Merge requests · GROMACS / GROMACS · GitLab

Aside from changing several forward declarations to includes (as required by the new standard), the changes should not be controversial, i.e. they don’t decrease the quality of our C++17 code just for the sake of compatibility with C++20 and have very little chance of breaking our existing functionality.

Is there interest in having C++20 “optionally supported” in this way? If yes, I would be glad to go forward with it and push these changes to be reviewed separately.

1 Like