# C++20 support in the codebase

**URL:** <https://gromacs.bioexcel.eu/t/c-20-support-in-the-codebase/7458>\
**Category:** Developers discussions\
**Tags:** cpp, clang, gcc\
**Created:** [October 24, 2023, 9:57am UTC](https://gromacs.bioexcel.eu/t/c-20-support-in-the-codebase/7458 "2023-10-24T09:57:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vedran](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/vedran/32/1784_2.png) [@vedran](https://gromacs.bioexcel.eu/u/vedran)\
**Post date:** [October 24, 2023, 9:57am UTC](https://gromacs.bioexcel.eu/t/c-20-support-in-the-codebase/7458/1 "2023-10-24T09:57:42Z")

</div>

Hello,

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](https://gitlab.com/gromacs/gromacs/-/merge_requests/3871)

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.
