Open davidbolvansky opened 3 years ago
In C++, those variables are initialized by the default constructor, and the warning isn't aware that the default constructor leaves the variable uninitialized. That happens here: https://github.com/llvm/llvm-project/blob/1cf3d68f9731199b3f753c5a87826c40a4d2168b/clang/lib/Analysis/UninitializedValues.cpp#L788
We'll also need to think about how to treat the assignment operator: if we don't explicitly handle it, we'll end up here: https://github.com/llvm/llvm-project/blob/1cf3d68f9731199b3f753c5a87826c40a4d2168b/clang/lib/Analysis/UninitializedValues.cpp#L435 and the right-hand side as a const-reference use, which means we'll warn immediately on an assignment under -Wuninitialized-const-reference, but we should probably warn unconditionally, since we "know" the assignment operator reads from its RHS operand.
@llvm/issue-subscribers-c-1
Extended Description
https://godbolt.org/z/ob19oYzoj
Maybe due
RecordDecl
vsCXXRecordDecl
somewhere? Any hints where to look?