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

**URL:** https://discourse.cmake.org/t/clang-tidy-g-c-standard-command-line-parameter-incompatibilites/8526
**Category:** Usage
**Created:** [July 15, 2023, 5:36pm UTC](https://discourse.cmake.org/t/clang-tidy-g-c-standard-command-line-parameter-incompatibilites/8526 "2023-07-15T17:36:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![infohoschie](https://discourse.cmake.org/user_avatar/discourse.cmake.org/infohoschie/32/3611_2.png) [@infohoschie](https://discourse.cmake.org/u/infohoschie)
#### Post date: [July 15, 2023, 5:36pm UTC](https://discourse.cmake.org/t/clang-tidy-g-c-standard-command-line-parameter-incompatibilites/8526/1 "2023-07-15T17:36:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [July 18, 2023, 12:12am UTC](https://discourse.cmake.org/t/clang-tidy-g-c-standard-command-line-parameter-incompatibilites/8526/2 "2023-07-18T00:12:14Z")

</div>

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”).
