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

    <tr>
        <th>Summary</th>
        <td>
            std::variant breaks constructibility of empty initializer list structures
        </td>
    </tr>

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

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

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

<pre>
    Problem: a nested structure with default-initialized members is no longer *constructible* if we use it in std::variant

Code ([more detailed version](https://gist.github.com/twasilczyk/381a75865b9c07e5e3017860e8f84b30) with failing std::variant::emplace):
`clang++ --std=gnu++17 emplace-example.cpp`
`g++ --std=gnu++17 emplace-example.cpp`
```
#include <variant>

struct Container {
    struct A {
        int x = 0;
    };

 std::variant<A, int> mVal;  // comment out to make static_assert pass
};

static_assert(std::is_constructible_v<Container::A>);

int main() {}
```
Error: `error: static_assert failed due to requirement 'std::is_constructible_v<Container::A>'`

Initially, I was suspecting libstdc++, because it builds fine with bionic/libcxx shipped with AOSP. It failed both on g++ 12.2.0 and clang++ 14.0.6. But then I tried g++ and clang++ from today's (2023-06-28) ToTs and it builds fine (with my system libstdc++) on current g++ and still fails on clang.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVEtvKjkT_TVmU6JlbPq16AWPIGX1Xem7mm3kdldDTdw2Y7uTcH_9yN1cQsisZhAy-FFV55x6qBDoaBEblm9Zvl-oMZ6cb-K7CmT0r8vronXdpfnhXWtwYHIDCiyGiB2E6EcdR4_wTvEEHfZqNHFJliIpQ7-wgwGHFn0ACmAdGGeP6IGJjXZ2tqbWIBMboB7eEcaAQBHIQogdkxsmN2_Kk7KR8T3jm3nduQ6BiYrl28F5hA6jIoMdvKEP5CzL90xUpxjPIfkQByYORwoxO1I8jW2m3cDE4ZMhEwdZrVSZV0Xe1pqXmKPkq7IqOFZ9tW4lZ6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