Fix/implement C++2020 compilation, tests, and CI #1017
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The C++2020 features (
std::span
support) were not enabled in the CI. As a result, the code had compilation issues that were never caught. Furthermore, the compiler versions in the README did not match up to the compilers that were actually being tested. For instance, the minimum GCC version advertised is 8, but we are testing 7.5.0 instead. The precise versions we should be testing will be re-visited in a later PR. But for now, this PR simply updates the README to be accurate to what is currently being tested.Previously, the guard for the span tests was
__cplusplus >= 202002L
. Unfortunately, this does not work for all compilers. For instance, inGCC 10
, running with-std=c++20
will fail the above condition (__cplusplus
will still be at 2017), and yet__cpp_lib_span >= 202002L
will be true. But forGCC 9
andGCC 8
,__cplusplus
will still be at 2017 and__cpp_lib_span
is undefined (neither have<span>
support). In all cases above, the span tests will be silently skipped.To avoid this confusing / incorrect (in the case of
GCC 10
) behavior, make the span tests execute unconditionally if running in CI mode with C++20 enabled. If a compiler version does not support span, the C++20 version should be explicitly removed from its CI jobs.