Menu

False positive: functionStatic [inconclusive]

CHR
2020-09-08
2020-09-08
  • CHR

    CHR - 2020-09-08

    Here is an odd one: if there is a variadic function defined in a base class, cppcheck reports that a function calling it in a derived class could be static, albeit tagged as inconclusive:

    class Base {
        int i{};
    public:
        void foo(...) const { bar(); } // no warning without ...
        int bar() const { return i; }
    };
    
    class Derived : public Base {   
    public:
        void doIt() const { // performance:inconclusive: Technically the member function 'Derived::doIt' can be static
            foo();
        }
    };
    
    int main() {
        Derived d;
        d.doIt();
        return 0;
    }
    
     
  • Daniel Marjamäki

    Thanks! There seems to be a parser problem. I created ticket https://trac.cppcheck.net/ticket/9885

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.