Fix small issues in preparation for C++20#653
Conversation
hughcars
left a comment
There was a problem hiding this comment.
LGTM, one missed to_array that possibly also needs fixing.
|
Ok, I found one more issues with ADL on |
f16cd29 to
59c04ab
Compare
|
Would it make sense to have one test that compiles with C++20 (to check we stay compliant)? |
Yes, probably good to have one test on a modern "reference" compiler if that is easy to do. And we can only do some quick tests, since the compilation is the important part. Different compilers (clang, gcc) have different ways they deal with language changes (like what standard library headers are included by default), so we really want a full test suite like in #654, but that needs a cleaned up compiler support matrix. |
|
I have not tested this, but this might work for the spack.yml: build-x64-gcc-c++20:
needs: filter
if: needs.filter.outputs.test == 'true'
runs-on: [self-hosted, x64]
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/palace-ci
with:
toolchain: gcc
variant: "cxxstd=20"
run-regression-tests: 'false' |
- Future proof as fmt will enforce compile time check in c++20
- Causes error in C++20 due to static type enforcement in fmt - Replace std::back_inserter with fmt::appender as iterator - Minor printing fixup
- Works with both c++17 and c++20
GCC 16 will set C++20 at the default and is expected to be released soon. Currently compiling main with C++20 causes compiler failures, due to small issues (changes in how fmt deals with typing, ADL ambiguity). This PR fixes these issues in a way that is compatible with both C++17 and C++20, so that people can compile with both. This PR does not actually enable C++20 or any C++20 simplifications.