Issue 132001
Summary `clang-analyzer-optin.cplusplus.UninitializedObject` false positive with unnamed fields
Labels clang:static analyzer, false-positive
Assignees
Reporter firewave
    ```cpp
struct S
{
 S(bool b)
    : b(b)
    {}
    bool b{false};
    long long : 7; // padding
};

void f()
{
    S s(true);
}
```

```
<source>:4:9: warning: 1 uninitialized field at the end of the constructor call [clang-analyzer-optin.cplusplus.UninitializedObject]
    4 |     : b(b)
 |         ^
<source>:7:15: note: uninitialized field 'this->'
    7 | long long : 7; // padding
      |               ^
<source>:12:7: note: Calling constructor for 'S'
   12 |     S s(true);
      | ^~~~~~~
<source>:4:9: note: 1 uninitialized field at the end of the constructor call
    4 |     : b(b)
      | ^
```
https://godbolt.org/z/7zzoK97x5
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to