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

    <tr>
        <th>Summary</th>
        <td>
            cppcoreguidelines-prefer-member-initializer should not touch assignments to references
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    clang-tidy check cppcoreguidelines-prefer-member-initializer (tested with LLVM 17.0.1) overwrites reference member initialization by assignment value found in the constructor body.

Before
```
class Lock
{
public:
 Lock(bool& lock) : m_lock(lock)
    {
        m_lock = true;
 }
private:
    bool& m_lock;
};
```

After
```
class Lock
{
public:
    Lock(bool& lock) : m_lock(true)
    {
 
    }
    
private:
    bool& m_lock;
};
```
Since m_lock is a reference to bool and already initialized in the member initializer list the assignment to m_lock should be left as it is.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysU02PmzAQ_TXmMgoyhgQ4cNhVFPWwPbXqtbLNENw1GNnjrNJfX_GRbFr10KpFyHg8njfzhjcyBHMeERu2f2b7YyIj9c43n3s3yPAhIgXdJ8q110ZbOZ53ZNor6B71K-hp0s7jOZoWrRkx7CaPHfrdgINCvzOjISOt-Y4emKgIA2ELb4Z6eHn58hGyMuVpxkQN7oL-zRvCAAsCjhphRYE7iiTjRlBXWEsecCS4SBsROhfHFswI1CNoNwbyUZPzMNedMn5k_Gldn7FzHreTA9_exdRWhgAvTr9u7vJ53UxRWaNZvkGsV0SlnLNMHMAuZg0sf4Lh62pV2-EWAQB3NNie9Sqw_AjkI7L85mflccvrzUUSvicGgFvSLdEtaI6573-mta5PHaH_N9oAf8R8IfN75o9nxwfjP7L9ZBblrL01AeSDnsgtgCDHFqT1KNvru7jwrp9fZYcerAm0-B6UR-6WJvQu2hYUgsWOQAYwBCakSdvkbZ3XMsEmO9SVyHmViaRvZFHwuiix3lcyK-q8qlvJuRQl71TZqS4xjeAiz7jYZ7w47EVaVhxVW-aHVu3LIlOs4DhIY1NrL0Pq_DkxIURsSp7VIrFSoQ3LQAsx4hssTibEPN--mWN2Kp4DK_jMLLyjkCGLzd_M9UZ-dHNHou4fWhTmHt3bH5LobdMTTWH-x-LExOlsqI8q1W5g4jQXsX12k3ffUBMTp6X0wMRpofYjAAD__w_ycEg">