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

    <tr>
        <th>Summary</th>
        <td>
            std::visit produces duplicate code for identical branches
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

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

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

<pre>
    See https://godbolt.org/z/3436hhhz6 for an example, where we're generating identical copies the deletion code for each variant. https://godbolt.org/z/1c7PsGK4P shows that libstdc++ produces a single copy (with nothing else changed), so I assume this is something related to libc++'s implementation of variant and/or visit?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEkr1u3DAQhJ-GahY-SCR9kgoVdgIFQRoDeQL-7IkMKPLAXfliP30gxcEFaVKx4sx8M2uI4pIRJ_H4LB4_N2bjUOpEK2I2sbHFv03fESEwX0moJyFnIeeleFsSn0pdhJzfhZyVVucQwvsZLqWCyYA_zXpNKOQnuAWsCDcUsq8IC2ashmNeIHrMHJ1J4Mo1IgEHBI8JOZYMrng81NC4AK-mRpP59N8knetf6Ms3_QIUym3XNAwpWmLvhHwW8hmutfjNIYEBinlJuPu_gZDDLXKAXDjs8TARggsmL-iFHHcUKvAVDNG2InCIBJGAyoq_P1RMhtEDl93ww03IniDuXayY2Rxo5fKHB0z2Qs6lwmukyELNjZ-UH9VoGpy686D6s1ZD14RpNIN32mocB9tfbD_I1nbKa9X5UTllmjjJVqr2sevatht1d1J9awd9UW5onbajErrF1cR0Sul13StrItGG01me9dAkYzHRcQhS_p1f7odRp_3Tg90WErpNkZjuMhw54UTs913U04Fyb9lv1xSdYbxPel_eVpNdQGq2mqZ_to0cNntyZRVy3r0-nodrLT_QsZDzkZ-EnA-EXwEAAP__wlHs1A">