<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/126841>126841</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] cppcoreguidelines-pro-type-member-init doesn't handle fields conditionally initailized in body well
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          qqiangwu
      </td>
    </tr>
</table>

<pre>
    version: clang-tidy 18

the following code will not be flagged:

```cpp
struct X {
    int x = 0;
    int y;

    X();
};

X::X() {if (x>0) y = 0;}
```

but this will:
```cpp
struct X {
    int x = 0;
    int y;

    X();
};

X::X() {}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEUlGOozoQPE3z00pkbAjwwQejvJxhfm3cQD85NoPNZNjTr0jQzmgvsJIly9Xd1VVW6Rh59EQtlG9QXjO9piks7ccHaz8-1swEu7WftEQOHlSHvdN-PCW2G-Y1iA5ElybCITgXHuxH7IMlfLBz6ENCQzg4PY5kQXWvdriI1-nnGUQX07L2Cd8RqjcQHSIi-4RfCOqKAtRPcHs9D-QdZA2yObDq-qf4vu9S3VHfiXlAkPUXqP_Ejmzf5NX1p6TXvFkTponj08ah-x-I_ktbZltlG9XojNq8Uo1SuSjqbGrzCwll7DBYq8gUppCkVXMpBF0MNaQzbqWQpZC5FEqJoj6T7WtZKVPbshwqk0Mh6K7ZnZ37vJ_DMmYc40ptLi91kWdOG3LxmRApvwMAUu6JWdp96mTWMUIhHMcUv3kSJ_fM1o-x8or9PPdhoXFlS449xdO8hFPaZjrd6W5oObHnhDZQ9CCrhJP21hEOTM5G7IO3nDh47dyGe6tmx7_IInvcE4sPci5bF9dOKc1x_1p5A3kbOU2rOffhDvK2izyuff3_1CeQt6fzCPJ2mP9s5e8AAAD__5956o0">