Search code examples
c++static-code-analysiscppcheck

cppcheck stops analysis of whole file when array of struct is declared


I am running static code analysis using cppcheck.

I have a cpp source file which as bugs like "null pointer dereferenced" etc.

There is a piece of code in file. A structure is declared inside a class

class Example{
    public:
        typedef struct {
            int num;
        }MyStruct;
};

When array of structure is declared

Example::MyStruct st_arr[5];

Cppcheck stops the analysis as soon as it reaches this code and doesn't go further and report other bugs in file.

But if I simply declare a struct variable

Example::MyStruct st;

It goes fine.

So, the cppcheck stops the analysis when array of struct (declared in a class) is created. Is this a issue with cppcheck?


Solution

  • I am a Cppcheck developer.

    I see such weird behaviour also. It is not by intention. I will investigate.

    Best regards, Daniel Marjamäki