Menu

unusedStructMember false positive

2024-05-24
2024-05-27
  • Steve Albright

    Steve Albright - 2024-05-24

    style: unusedStructMember - class member 'UnUsedStructMemberExampleTest::fakeTimestamp' is never used.

    class UnUsedStructMemberExampleTest: public Test
    {
    public:
       UnUsedStructMemberExampleTest() = default;
    
       const unsigned long int fakeTimestamp = 100000;
    
       void ExampleFunction(unsigned long int data)
       {
          EXPECT_TRUE(data != 0u);
       }
    };
    
    TEST_F(UnUsedStructMemberExampleTest, ShowProblem)
    {
       ExampleFunction(fakeTimestamp);
    }
    

    Note, I am using the google test library now too and this is in 2.14.

     
  • CHR

    CHR - 2024-05-27

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12782

     

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.