<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95035>95035</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[rejects-valid] aggregate initialization of classes with immovable members are broken
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ericniebler
</td>
</tr>
</table>
<pre>
The following well-formed C++20 code is rejected by clang (all version tested from 13 through trunk):
```c++
template <class T>
struct single : T {};
template <class A, class B>
struct pair {
A a;
B b;
};
struct immovable {
immovable() = default;
immovable(immovable&&) = delete;
};
struct S{};
int main() {
// error: call to deleted constructor of 'immovable'
[[maybe_unused]]
auto a = single<single<immovable>>{single<immovable>{immovable{}}};
// error: no viable conversion from 'pair<int, immovable>' to 'int'
[[maybe_unused]]
auto b = single<pair<int, immovable>>{pair<int, immovable>{42, immovable{}}};
// error: initializer for aggregate with no elements requires explicit braces
[[maybe_unused]]
auto c = single<pair<S, immovable>>{pair<S, immovable>{S{}, immovable{}}};
}
```
Other compilers get this right. https://godbolt.org/z/rorxx1jK9
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVMFy4ygQ_Rp06YoLIcvIBx2ieHzZwx4m9y1AbYkZBF5ATjJfv4VkW06cyuxUUTaipdfvdTdPhKA7i1iTsiHlLhNj7J2v0WtlNUqDPpOufaufe4SDM8a9aNvBCxrzcHB-wBaeCGsIaxgF5VoEHcDjD1QRW5BvoIywHRBWCWPghD5oZyFiSOGDdwPkBcTeu7HrIfrR_iRsS4pHQneEXn43dF5qzjSfRhyORkQEUjwpI0KAZ1J8m2Mh-lFFCNp2Jr3wCM9AeEP4jhTNLfQ9yCNhTzBvm494R6H9hDMdAjyCuOIBNCAX9LtMZwg9DO4kZGK14FwPCasI2wIpdtDiQYwmLvi3L93sN9O6fGMw4u9JfP-0FtpGGIS2FxILP8L2hO0BvXc-FVOlXkZ3zteCcnZGdh7cAQjjNwT5GWWar2YQbxL_Ge0YsCXlLq1zEjFGB2LSMfeNFE_XzYJXfEuLN5-HeLM8zhrn9V7pvSLr4KSntihnL1M6jSdhPLU9JbIxzca7fIynOiTBKfhHUuV7qV8kmXR9EefNmr0__BPp2uqohdG_0MPBeRBd57FLd-JFxz5VBg0OaGO61_-O2mMAfD0arXQE6YXCcIX-P7rVp7q_f6n6PsqbyxD_XjjfffCR24L8HXv0oNxw1AZ9gA4jxD6ZmO76uII-xmNIhjSVrXOtdCaunO8I2_8ibO-df33Nf_y1neGyti7abbEVGdY5zyta5hXNs77OK6aKQuZCUZlzVlDOK7FhvNy21ZbzTaZrRtmabnLKaLFZ56sSRSlVRUuq5CavFFlTHIQ2K2NOQ2KQ6RBGrLclLcrMCIkmTC7OmMUXmIKEsWTqvk7fPMixC2RNjQ4xLChRRzPZ_2zb4eEkjE6duxmF65CImG6GO8wWiWEeksXVBhxkKqPwCNK7n2iz0Zv6QxV17Ee5Um4gbJ94nP8ejt4lCoTtJ_aBsP2s7lSz_wIAAP__MUsB1g">