Incorrect S1767 because SonarLint thinks that rapidjson::Pointer is C++-Pointer

In template functions (funnily not in functions) a rapidjson::Pointer is mistakenly recognized as a C+±Pointer and so SonarLint mistakenly detects the bug S1767 (see screenshot).

  • Operating system: Windows 10
  • SonarLint plugin version: 6.11.158935
  • Programming language you’re coding in: C++
  • Is connected mode used: no

Hello @TimoB,

To investigate an issue we will need a reproducer of the file with the issue.

Please follow the documentation to generate a reproducer.

Let me know if you prefer to share it privately, I can send you a PM.

Thanks,

sonar-cfamily.reproducer (4.8 MB)
Dear Abbas
this is the reproducer-file

Thanks in advance for your help

Hi @TimoB ,

by looking at the reproducer it seems that during the analysis of OpcUaCmdLogger.h we are not able to find pch.h file, causing a series of parsing errors. The first comes from the first header Errorcodes.h using std::string and not being declared at that time due to pch.h not found.

Do you have an idea why pch.h is not found?

Hi Massimo,

I do not know why pch.h is not found. It is added in our project and SonarLint does not show any errors when the file is analysed.

Why does SonarLint need the pch.h? We are looking at a header file so it should not be required (at least for compiling pch.h has not to be included )

Best

Timo

Hi @TimoB ,

the pch.h is set to be forced included for the entire project, hence it is used for the header file too.

If we forget about that, your header file is currently not compilable by itself as explained in the previous answer, having Errorcodes.h using std::string and not including string.