Menu

False possitive [virtualDestructor] report

2020-09-21
2020-09-21
  • Artyom Tetyukhin

    Hi,

    do you know about this problem ?

    :include\gtest\gtest.h:1432:12: warning:inconclusive: Class 
    'UnitTest' which has virtual members does not have a virtual destructor. [virtualDestructor]
      virtual ~UnitTest();
    
     
  • Daniel Marjamäki

    I don't think so.. a reduced example code would be nice..

    however I would recommend that you remove the -Iinclude and replace it with --library=googletest

     
  • Artyom Tetyukhin

    I cannot remove the -Iinclude and replace it with --library=googletest

    I use CMake

    if (CMAKE_CXX_CPPCHECK)
      list(APPEND CMAKE_CXX_CPPCHECK
        "--std=c++11"
        "--enable=warning,performance,portability,information,missingInclude"
        "--inconclusive"
        "--force"
        "--inline-suppr"
        "--quiet"
        "--suppressions-list=${CMAKE_SOURCE_DIR}/.CppCheckSuppressions"
      )
    endif()
    
    #include <gtest/gtest.h>
    
    struct TestSuite : testing::TestWithParam<int>
    {
    };
    
    TEST_P(TestSuite, Init)
    {
       ...
    }
    
    INSTANTIATE_TEST_SUITE_P(Test, TestSuite,
       testing::Range(95, 105)
    );
    
    int main(int argc, char ** argv)
    {
        ::testing::InitGoogleTest(&argc, argv);
        return RUN_ALL_TESTS();
    }
    

    Google Test Version 1.10.0 (https://conan.io/center/gtest/1.10.0/)
    clang-cl

    clang version 10.0.0 
    Target: x86_64-pc-windows-msvc
    Thread model: posix
    

    Cppcheck 2.1

     

    Last edit: Artyom Tetyukhin 2020-09-21

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.