<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/93405>93405</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Aggregate initialization of an immovable base with a prvalue attempts to call the deleted copy constructor
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JankoDedic
</td>
</tr>
</table>
<pre>
Works on GCC and MSVC.
Godbolt link: https://godbolt.org/z/KdETMao9K
Code that reproduces the issue:
```cpp
#include <type_traits>
struct Immovable
{
Immovable() = default;
Immovable(const Immovable&) = delete;
Immovable&
operator=(const Immovable&) = delete;
};
class Base
{
Immovable immovable;
public:
Base
clone()
{
return Base{};
}
};
struct Derived:
Base
{
Derived
clone()
{
return Derived{Base::clone()};
}
};
static_assert(std::is_aggregate_v<Derived>);
int
main()
{
Derived d0;
Derived d1 = d0.clone();
}
```
Error message:
```
<source>:31:24: error: call to implicitly-deleted copy constructor of 'Base'
31 | return Derived{Base::clone()};
| ^~~~~~~~~~~~~
<source>:15:15: note: copy constructor of 'Base' is implicitly deleted because field 'immovable' has a deleted copy constructor
15 | Immovable immovable;
| ^
<source>:7:5: note: 'Immovable' has been explicitly marked deleted here
7 | Immovable(const Immovable&) = delete;
| ^
1 error generated.
Compiler returned: 1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVV2PozYU_TXOy9VEYBNIHnggX6vtap9atY8jY98BdwxGtsl29qG_vXIggWQn066KImJs3-Nz7HN9uXOqahFzstqS1X7Be18bm__C21ezR6nEojTyLf_D2FcHpoVPux3wVsLXX3_fLUm0J1ExvD8ZWRrtQav2lbACau87R1hB6JHQYzWMLo2tCD1-J_T4RR5--8rN5sscZGckgq-5B4udNbIX6MDXCMq5HgPabDJJo-Enum7soUy1QvcSgbCdf-vw2VuuvCPsMI903vbCw-emMSdeahzHsu3QAIDZGF0TugHC9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