Menu

False positive

2023-01-05
2023-01-07
  • Lukas Sommer

    Lukas Sommer - 2023-01-05

    Consider the following code:

        QByteArray message = QByteArrayLiteral("Test1");
        message += QByteArrayLiteral("Test2");
        QVERIFY2(2 >= 0, message.constData());
    

    This produces two (!) cppchekc warnings:

    "Variable 'message' is assigned a value that is never used. (CWE-563)"

    I would expect no warning at all.

    Lukas Sommer

     
  • CHR

    CHR - 2023-01-06

    Thanks for reporting, fixed by https://github.com/danmar/cppcheck/pull/4683

     
  • Lukas Sommer

    Lukas Sommer - 2023-01-07

    Thanks a lot for the quick fix!

     

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.