Menu

cppcCheck doesn’t understand “enum class” in .h file and reports [syntaxError] syntax error [cppCheck]

2022-02-24
2022-03-07
  • Siva Ramaraju

    Siva Ramaraju - 2022-02-24

    The CppCheck syntax error in xLogger.h:90 is a bug in CppCheck. It doesn’t understand “enum class”.

    private:
    friend struct Log;
    enum class Level
    {
    NONE,
    VERBOSE,
    DEBUG,
    INFO,
    WARNING,
    ERROR,
    CRITICAL
    };

    Looks like CppCheck doesn’t understand “enum class” in headr file.
    It reports as Severity: (error) with ErrorMessage: [syntaxError] syntax error [cppCheck]
    This is reported with latest version 26. The language argument is already set to c++ (--language=c++)

     
  • Siva Ramaraju

    Siva Ramaraju - 2022-03-07

    Hi Daniel, Cppcheck team,
    Greetings!
    This issue seems to repro on released version 2.6 and the latest 2.7 aswell.
    Is there any way to get more detail as to what cppcheck does not like about the syntax. This looks a false-positive. It would help if some one from Cppcheck team get some attention on this [syntaxError] cppCheck issue?
    Any ETA when this would be resolved.

     

    Last edit: Siva Ramaraju 2022-03-07
  • CHR

    CHR - 2022-03-07

    Is there a typedef with the same name as one of the enum values? There was a recent fix for that: https://github.com/danmar/cppcheck/pull/3867
    There could also be a conflicting define in a library .cfg file.

     

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.