<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - scan-build doesn't detect unitianilized class members in copy constructor"
   href="https://bugs.llvm.org/show_bug.cgi?id=37086">37086</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>scan-build doesn't detect unitianilized class members in copy constructor
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dcoughlin@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>marzec.wojciech@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I wish to have a warning that some member in copy constructor/assignment
operator isn't initialized. 


#include <iostream>
using namespace std; 

struct B 
{

    int member;
    B() 
    {
        member =111;
    }
    B(B const & )
    {}
    B& operator=(B const & )
    { }

    void hello() const 
    {   
        cout << "member value " << member << "\n";
    }


};
struct D :  B 
{

    D(){}
}; 


int main()
{

    B* b1_ptr = new B; 
    b1_ptr->hello();
    B* b2_ptr = new B(*b1_ptr);    
    b2_ptr->hello();

}

Above code gives me output:

member value 111
member value 0

Scan-build generaly warns about reading of unitialized variables but in this
case it is initialized with 0 by compiler however users forgets to do copy of
value and he expects to have the same object. So in this case  the user should
be warn that he forgets to copy member value in copy constructor/assignment
operator. 

Such case is handled by lint and it is a gap for unsecure code could you
implement such checking also in scan-build?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>