Clang doesn't check if all class members have been initialized inside overloaded assignment operators/copy constructors in the contrary to Lint. Instead of that Clang check usage of uninitialized variables. Such approach should be sufficient but what in case of the static casting as it is in following code:
#include <iostream>
using namespace std;
struct B
{
int member;
B()
{
member =111;
}
B(B const & )
{
}
B& operator=(B const & )
{
}
};
struct D : public B
{
void hello() const
{
cout << "member value " << member << "\n";
}
D()
{
}
};
int main()
{
D d;
D d2 = d;
B* br ;
D* another_d = static_cast<D*>(br);
another_d->hello();
}
Static casting is just coping byte by byte and it can't guarantee that all members are initialized however it is a gap for an unsecure code and it can be avoided by checking body of copy consructor as it is done in lint case.
So it could be an input for a Feature Request. What is your opinion?