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

    <tr>
        <th>Summary</th>
        <td>
            `std::variant` with alternative with `constexpr` constructor is not a literal type
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    This prevents useful by-value `constexpr` functions: https://godbolt.org/z/5ovrYzjdT.
```C++
#include <variant>
struct X { constexpr ~X() { } };
constexpr void f(std::variant<X>) { }
```
```
<source>:3:33: error: constexpr function's 1st parameter type 'std::variant<X>' is not a literal type
constexpr void f(std::variant<X>) { }
                 ~~~~~~~~~~~~~~~^
/opt/compiler-explorer/clang-trunk-20220730/bin/../include/c++/v1/variant:1467:39: note: 'variant<X>' is not literal because it has data member '__impl' of non-literal type '__variant_detail::__impl<X>'
  __variant_detail::__impl<_Types...> __impl;
                                      ^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVM2OmzAQfhpzsYLAXgc4cEiySaWeetjD9hQZGIK3Dka2od19-o6TsFmlWVVVkT32jOfP34ypTPNaPnXK0cHCBL13dHTQjppWr4tJ6hEoWSa16Z2HX4PFPW3HvvYKJYSvaOf9EDaE7XAcTFMZ7WNjD8i94RRmst_fXpqnmCSPJFmhg_PYELYO4yxlXPW1HhuMxjeTtEr2nvDt-dR5O9aePlOSrel7KshtnwnLCStOByR7DJPwi8-r4mRUQ1tUdb4JqfLVe4TNc4hy9XCT5H2Wb5wZbQ3BlK94mIFQsNbYsLmGnrEiLHM0dZ4O0sojeLDUvw54W5R_llRGsSq98VRSrdBC6pPNf9-O3n4I5D8MsZ1rtjODR1qb46A02AWmo40FG2Ra9ocF1q3_sWAJY0nGExRXCpHYxTGSS72D7qUT2G5KA5mzX6UPyyyAWwRMEQgIK-LyKVAzTBXUEruYKk876WgjvaRHOFaIOmrv9-o46GBmWjTrFx_RPStcIuwb8FLpM6oXs_egM5h_0d4_oVcX4535ls7S9SeVuPtdEZ_7MIIyXYqCJXkqRNSUvCl4ISOvvIYSz__oBHy1P5XvqNR40156NcFZcPu2T0x4bcbe775otLq8efToaKxibANktJ7mZTFY8wJ1aBHl3Agu_A6WOWNRV7YFF2klWFUkRSLzWkjIM0Ca1W3L8ybSsgLtSiLWRDxGqpybKEWDVMQPbbvMlyIsNRSCk4cEjgh-HAKH309ky1MO1XhweKiV8-56KJ1Thx5g9i9H3xlbfjUd6O2Xb9Ep3_KU7G9I0YVu">