Menu

Is it possible that cppcheck is not C++11 ready?

antred
2015-07-01
2016-07-17
  • antred

    antred - 2015-07-01

    I've recently done some serious refactoring on an existing project that was written pre-C++11. In my rewrite I made heavy use of C++11-features such as range-based-for, lambdas, trailing return types, etc, etc.
    The code compiles just fine on GCC 4.9.1, and testing has shown that it works as expected.

    Letting cppcheck have a go at my code results in it giving exactly one error in lots of files, namely a "syntax error" in some random code line that contains no syntax errors whatsoever.

    There are also tons of warnings about data members not being initialized in the constructor, when I clearly used delegating constructors to defer the initialization to another overload of the constructor, something that cppcheck doesn't seem to recognize.

    All this leads me to suspect that cppcheck doesn't properly support C++11 yet.

     
  • Daniel Marjamäki

    All this leads me to suspect that cppcheck doesn't properly support C++11 yet.

    yes, I think so.

    but I don't think the situation is hopeless.

    feel free to open some tickets if you can create short code examples that don't work.

     
  • antred

    antred - 2016-07-04

    Hi. Any chance cppcheck will learn to deal with C++11/14 code any time soon? Version 1.74 still poops out on every single one of my .cpp files. :-(

     
  • Mr. X

    Mr. X - 2016-07-07

    We are making progress on C++11 and C++14. For example, C++14 digit separator support has improved since the release of 1.74. Which features that cppcheck does not support are you using and which of them is causing the trouble?

     
  • antred

    antred - 2016-07-17

    I'm not 100% sure which feature it is, but since I'm getting that error for every single file and the one common feature I'm using everywhere is trailing return types, I'm guessing that's what's causing the problem.

     
  • Mr. X

    Mr. X - 2016-07-17

    Trailing return types is a feature that we do not support yet. I have started to implement it now. See also http://trac.cppcheck.net/ticket/4348

     
  • antred

    antred - 2016-07-17

    Fantastic! :) Thanks a bunch for your work!

     

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.