clang-analyzer-optin.cplusplus.UninitializedObject false positive with unnamed fields (original) (raw)

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