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

    <tr>
        <th>Summary</th>
        <td>
            `std::variant` cannot be used in constexpr functions with non trivially destructible types
        </td>
    </tr>

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

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

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

<pre>
    Hello,

I'm having an issue with Clang 14.0.6 and GCC 12.2.0's libstdc++: initializing a `std::variant` that may contain any non trivially destructible type will trigger the following error: `placement new would change type of storage`.

Here's a [minimal repro](https://github.com/JPenuchot/bug-repros/blob/main/repros/constexpr-variant-of-non-trivially-destructible-type.cpp) as an example ([here on Compiler Explorer](https://godbolt.org/z/bq1baea5r)), which GCC 12.2.0 does accept and compile.

Regards,
Jules
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFU9tunDAQ_Rp4GYHALLvLAw_Jpm2ap6p_4MsAroxNbbObzdd3TNJtKvUiWfgy9syZcw7CqWv_iMa4jJ2y6iGr7l6_nzN2mGHiZ21H4BZ0CCvCRccJTobTWb0rq3JPIQWfTieoWcnKih4FMFqEqGTG7tNo7kBbHTU3-mXLBdm-ojgFaJy519xGOoI48Qgzv4J0NnJtKfUVrLMQvT7Tc3MFhSH6VUYtDEK8LgmQMenCOKKnDAiDo14uqRB673wqT8kXwyXOaCNYvMDFrUaBnKiNtzRugBCd5yPS5fI9D4_oceuKcLf3M7UycwMeF--y9iFjxynGJaRm2EcaIxG0ilK6mTZPX9CucnKR1mIdi-1VSBvjBE0zdUnT7ZgaDxGfF1-80VK4oSAGihsDxXsGigS9lMuSsQ54SCrhM58X4oZwEdqJsAMReHLzog0R9OF5Mc6j_yNyp4QzsXR-pN1LQvm9Fhx56yn_Nk5wmbSc3ukNyiEVlhKXuFlBvpb6jcKvOHKvws1gT6vBkGNf7_esrpuuO-Sqb1TXdDyPOhrs_-IQya11EQTCGlCRreDGGAyrJVZo--rR__gm5Ks3_T-kM-b8cypInW8ok4jbT5CUag8t2-VTL_hB8mY37Kru0DE5dEeUbBDYCjy2XKnccIEm9CRGxljy3paC1iRBrntWMVZ1Faurumv35dDIQzNUoubHVgzDkO0qJJOYMuFIyuS-3yCRmwIFjQ4x_AryEPRoEbdylJ-vcXK-v9kw34r3G_gfibpNgw">