Summary
-------
Compile the JDK's C++ source code as the C++17 language.
Goals
-------
Since JDK 16, the language features used by C++ code in the JDK have been set to the C++14 language standard. The purpose of this JEP is to formally allow C++ source code changes within the JDK to use C++17 language features, and to give specific guidance about which of those features may be used in HotSpot code.
Non-Goals
-------
This JEP does not propose any usage or style changes for C++ code in the JDK that is outside of HotSpot. HotSpot's Style Guide has already been adapted for C++14 previously and should require only minimal changes.
Description
-------
### Changes to the Build System
Microsoft Visual C/C++ Compiler: Visual Studio 2019 is required for JDK 17 and above. (Earlier versions will be rejected by configure.) Change the existing -std:c++14 flag to -std:c++17 for C++.
Other supported compilers: Replace the -std=c++14 option -std=c++17.
The minimum supported version of gcc is 8
The minimum supported version of clang is 10
### Changes to C++ Usage in HotSpot code
The existing restrictions and best-practice recommendations for C++ usage in
HotSpot code are based on the C++14 language standard, and described in the
[HotSpot Style Guide](https://wiki.openjdk.java.net/display/HotSpot/StyleGuide).
Lists of new features for C++17, along with links to their
descriptions, can be found in the online documentation for some of the
compilers and libraries:
* [C++ Standards Support in GCC](https://gcc.gnu.org/projects/cxx-status.html)
* [C++ Support in Clang](https://clang.llvm.org/cxx_status.html)
* [Visual C++ Language Conformance](https://docs.microsoft.com/en-us/cpp/visual-cpp-language-conformance)
* [libstdc++ Status](https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html)
* [libc++ Status](https://libcxx.llvm.org/cxx1y_status.html)
Risks and Assumptions
-------
Code that works with the current specification of C++14 may break when compiled as C++17, or may silently change behaviour without compilation errors due to differing semantics between the language versions.