Menu

uninitMemberVar false positive

2024-11-15
2024-11-15
  • Adam Ryczkowski

    Adam Ryczkowski - 2024-11-15
    template <typename T>
    struct A
    {
       explicit A(const T& r) : v{r} {}
       const T& v;
    };
    
    template <typename T>
    struct A<T*>
    {
       explicit A(const T* r) : v{r} {}
       const T* v;
    };
    

    Output:

    Cppcheck 2.10
    
    [test.cpp:11]: (warning) Member variable 'A::v' is not initialized in the constructor.
    
     
  • CHR

    CHR - 2024-11-15

    The current version is 2.16. The FP does not reproduce there.

     

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.