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

    <tr>
        <th>Summary</th>
        <td>
            false positive cppcoreguidelines-prefer-member-initializer warning, applying tweak produces broken code
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            false-positive
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          geza-herman
      </td>
    </tr>
</table>

<pre>
    See this example:

```c++
struct Base {
    int a = 0;
};

template <typename T>
struct Der: Base {
    Der() {
        a = 1;
 }
};
```

clang-tidy produces `cppcoreguidelines-prefer-member-initializer` warning for `a = 1` in `Der`. Applying the suggested tweak (puts `a(1)` into `Der`'s member initializer list) creates broken code.

If `Der` is not a template, this problem doesn't happen.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUU8GOqzgQ_BpzaRE5dhjgwCEz2Uh73v2BBjfgHWNbtpnZzNc_GSaT6N0esgRquauqqxqMUU-WqGPVK6suBa5pdqGb6AvLmcKCtuidunX_EEGadQT6HxdviMkz49t54fsZmHjNh59jCuuQ4BUjAatzBQBA2wQITF6AM5mLrL58f_BzosUbTARMvqWbJ4sLwb9M_vWAu1Bg8vw7aq6Khon2qZafnem4E0Cmeia8a97JB4N2KpNWN_DBqXWgCHkg7wcXaFq1IqMtxdIHGimUCy09hVJbnTQa_UWBvXD4xGC1nWB0IXffBbxw0DYXLtu1A5y9N7d8Mc0EcZ0miokUpE_Cd2Ci8Wva6JGJ5shEuyMk98Bgoo6wi4AnEWB0TNmJIRAmitAH904WBqfosE_69_hAAR3BupzJ3Xwm3vaMfXC9oQWUo2iZqBPM6D3ZQ6E6qVrZYkHdsa7qUy25bIu5U4oLVApPVSNGVRM2jWyUGPnYDqKveaE7wUXFW94eWy6O1aE-oUQusVF0aqphZCdOC2pzMOZjObgwFTrGlbpjVdfyVBjsycRtS4UY0UQqvYs66Q9iQuTNDV3uLPt1iuzEsxfxgZV0MtRtfXDvgz8I-J5utgh_Atwi-1mZJ7uLNZhuTsnH_J-IKxPXSad57Q-DW5i4Zl3fr9IH9x8NiYnrNnBk4vo980cnfgUAAP__DI8iDQ">