S3630 is raised on C++17 project

Hello @hstreidl,

Welcome to the community!

I moved you to another thread because I don’t think the two issues are related.

We are using SonarQube LTS Version 8.9.7 (build 52159) which has bundled CFamily v6.20 which should detect the correct C++ standard if I understood the previous comments right?

True and we should detect C++17 and not raise the issue with the since-c++20 tag. You can filter by tag on SonarQube to see the list of rules per C++standard or on rules.sonarsource,com.

for example here are the since-c++20 rules: C++ static code analysis | since-c++20

You will notice that S3630 is not one of them. S3630 is a cppcoreguidline rule that says ““reinterpret_cast” should not be used”. Independently of the standard.

Now the rule message is standard dependent. if you are using C++20 and the cast can be replaced by bit_cast the rule message will be: “Replace “reinterpret_cast” with a “std::bit_cast”.”
But if you are not using C++20 or the cast is not equivalent to bit_cast, the rule message will be:
“Replace “reinterpret_cast” with a safer cast.”.
If I’m not wrong, you are getting the second message which is expected.

Let me know if you have further questions,

1 Like