C++ - Support C++23 standard

The announcement about C++20 support is great!

Actually I did use the documented ( C/C++/Objective-C )
sonar.cfamily.cpp20=true
already.

How about C++23 ?
Is there a planned support as well? Or maybe soon a sonar.cfamily.cpp23=true to get started?

Reason is to avoid the error:
“java.lang.UnsupportedOperationException: Unsupported value of __cplusplus macro: 202100L”

Hello @schefenacker and welcome to the community.

We are glad that our effort to bring support for C++20 is appreciated.
Note that “sonar.cfamily.cpp20” is valid only for SonarQube 8.9LTS.
In SonarQube 9.x, C++20 is not an opt-in feature anymore. It is supported out-of-the-box.

Allowing any value for __cplusplus macro is tricky for us as it might lead to instability and to using our analyzer in a configuration where it has not been tested and validated.

We could imagine adding an opt-in feature for that, but there is no such plan right now.
Please, feel free to create a new feature request about that if you are interested.

About C++23, we will obviously support it at some point. It is very early to say anything meaningful about it (like features and timeline) as we are still focusing on expanding our C++20 support (parsing and rules).

By the way, out of curiosity, which feature of C++23 would you like to use and on which compiler?

Cheers,

Geoffray

3 Likes

A post was split to a new topic: Support for C++20 modules

As a workaround: Is there any commandline option or something similar to enforce the linter use C++20 mode, though it operates on C++23 code?

Hello @Timo_L, and welcome to the community,

There is no option to force a standard version for parsing the source files. This would most likely result in parsing errors and unreliable results.

As for opt-in C++23 support. I have added a ticket to record the traction: [CPP-4093] - Jira

Best regards,
Alejandro