clang-tidy / g++ "C++ Standard" command line parameter incompatibilites

I’m using clang-tidy for static analysis by defining CMAKE_CXX_CLANG_TIDY to the system installed clang-tidy executable.

I want to set the C++ Standard to C++23.
When using g++ (Version 13.1) cmake sets the command line parameter to “-std=gnu++23”.
Unfortunately the installed clang-tidy (Version 16.0.6) executable doesn’t recognize this parameter and fails with a “clang-diagnostic-error” - it expects the parameter set to “gnu++2b”.

When using clang as compiler CMake sets the parameter to the expected value and works together with clang-tidy.

Do you now a way to modify the command line for g++ / clang-tidy to work together?

Regards Thomas

There’s no mechanism that CMake provides to translate these kinds of things. The paired tool just needs to agree on what flags mean. For bleeding edge things, this usually means using clang with clang-tidy as the “what flag X means” usually takes time for the two compilers to agree on (here, when each says “yeah, C++23 is supported enough to rename the -std= flag value”).