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

    <tr>
        <th>Summary</th>
        <td>
            Redundant memset followed by memcpy not eliminated in ctors if this->field aliases a parameter
        </td>
    </tr>

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

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

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

<pre>
    Example https://godbolt.org/z/1exh1cjaj `C1::C1` has a memset from `Options()` ctor, and a memcpy from `options_ = options` but in the end the code is left with both (if you accidentally don't use the initializer list to init `options_` like in `C2`).

IIUC the concern is that `options` param and `this->options_` may alias. Does the restrictions against aliasing `this` from https://cplusplus.github.io/CWG/issues/2271.html apply to let us assume no alias?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcU8FupDoQ_BpzaQWZ9swwHDjkzYSnnJ70pNUeVwY34FljI9wkmXz9ykySnd0DWEB1d3VVoWO0gyeqxf4fsT9neuUxLPXlJax-yNpgrvXTm55mRzAyz1GoR4GNwGYIpg2O87AMApt3gU1Bb2PRXfQFxEGeioRUj6dCHCSMOoKGiaZIDP0SpgT5b2YbfBR4FFglVMdhEXgC7c0N3c3XL3S4oX-AUGf4eEhF7cpgPfBIQN5sZxcMgY3gqGd4tTxCG3gEgUfbwzWsoLvOGvKsnbuCCV5gybBG2qqtt2y1s--0gLORgcP27p5EGuzszwTelkVxkAKrXMizkI-3-_Pzt9MHHd_R4hMjHvV9n9Rm1ouetpXFQfJo44NQT_dzJn0F7ayOOZwDxa3lQpEX220g0IO2PvINZP3w2SgVb-r9aVw3uzWmKx8sj2ub2yCwOX3_V2BjY1wpCmwQyyIfeXKg59ldkwaOkkagY1wnAh9u84RqMlMrU6lKZ1QXpcSdPJa7fTbWZKqCUJX9sawKVWFR7vay6qWWZq9UdcxsjRJVgQUWVVFJmff9cWeIZN9Xsjx2SuwkTdq63LmXKUUt2xjW5R5VmTndkotbchE9vcL2USCmIC91qnlo1yGKnUxGxt9d2LKj-n8yqzfa81cyg3PhlQy018_4-cBAzk7WayaT_E4pjWB7-DSrt-TMTQ1KMd8cJaYlWxdX__XX3CTvwiSwSXQ-jod5CRfq-N6DbclfAQAA__9ggi-y">