Hi,
I think it’s time to start thinking about updating the requirements for Clang and GCC to support C++17 in our LLVM code.
We have process for this as explained in the Developer Policy.
This lays out the following requirements for updating the toolchain requirements:
It is a general goal to support LLVM and GCC versions from the last 3 years at a minimum. This time-based guideline is not strict: we may support much older compilers, or decide to support fewer versions.
And the process described is:
- An RFC is sent to the llvm-dev mailing list
- Detail upsides of the version increase (e.g. which newer C++ language or library features LLVM should use; avoid miscompiles in particular compiler versions, etc).
- Detail downsides on important platforms (e.g. Ubuntu LTS status).
- Once the RFC reaches consensus, update the CMake toolchain version checks as well as the getting started guide. This provides a softer transition path for developers compiling LLVM, because the error can be turned into a warning using a CMake flag. This is an important step: LLVM still doesn’t have code which requires the new toolchains, but it soon will. If you compile LLVM but don’t read the mailing list, we should tell you!
- Ensure that at least one LLVM release has had this soft-error. Not all developers compile LLVM top-of-tree. These release-bound developers should also be told about upcoming changes.
- Turn the soft-error into a hard-error after said LLVM release has branched.
- Update the coding standards to allow the new features we’ve explicitly approved in the RFC.
- Start using the new features in LLVM’s codebase.
This post is the first step of that.
I propose we update the requirements as follows:
- GCC to 7.1
- Clang to 5.0
- MSVC to 2019 16.0
- Xcode / Apple Clang to 9.3
For MSVC no change is needed since this requirement is already in place as described in this commit.
GCC 7.1 was released in May 2017, Clang 5.0 was released in September 2017, MSVC 2019 16.0 was released in April 2019 and Xcode 9.x was released in May 2018. All of these fall within the 3 year support window mentioned in the developer policy.
This would allow us to use C++17 features like:
- Structured Bindings
- Compile-time
if constexpr
-
constexpr
lambda - Init-statements in
if
andswitch
These are just some of the features of course, but I feel like C++17 is a much bigger step than C++14 was. Lot of good stuff in there.
I have prepared a spreadsheet on Google Sheet with the linux distribution compiler versions: LLVM Toolchain Support Matrix - Google Sheets
This sheet is editable and I hope we can use it in the future so this information doesn’t have to be collected over and over again. Feel free to update and add more distributions or operating systems in there.
If there are no concerns I will submit the soft-error patch to Phabricator next week.
Thanks,
Tobias