<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/79518>79518</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`-Wunused` fails to realize copy initialization might have side effects
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++,
clang:frontend,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
cor3ntin
</td>
</tr>
</table>
<pre>
Compiling with `-Wunused-variable`, we expect no warning to be emitted (constructor calls might have side effects), yet a warning is emitted for `s2`
```cpp
struct S {
S(int);
};
int main() {
S s(0); // no warning
S s2 = 0; // unused
S s3{0}; // no warning
}
https://godbolt.org/z/6zzfE9c4a
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0ksFuozAQhp9muIwSOWMgcODQNMsL9LBnYwzMytgIm3abp185VG12V5Usg2fG_zce_SoEHp0xDRQXKK6Z2uLk10b7VbrILut8_948-3lhy27EN44TQikOPze3BdMfXtXKqrMGSgH0jG8Gze_F6IjO45taXboUPXYGzcwxmh6BKu1diOumo19RK2sDzjxOESf1ajBwb9AMg9ExANVJ9d1EVJ9yHD61Br-mbgIlvLiCePrYS7EvvSx7ZOfhC8L5skcQEV-AKnYxYeRHGM7Xr__7zi7irNgBVUD1g8ALBqBK7LcRqAVqH979gMFACPKK4qFwH-BfRRLOF7E38J1cyj70NsW4BJBPe_Xo-87bePTrCNTegNrydht-1DpXWd_Ivpa1ykxzOouSqDjJIpsaoXKSiqivlCrrky5krbTRp6qsq1Nd5hk3JCgXJypIUiHlceg15UJ1Q9Wb8zB0kAszK7ZHa1_nxM44hM0057o4VZlVnbHhbi8iDXS5LwJ6Tmer3AjyaVi9i8b1_yV6VqPzIbIOKVdcs7VJmEO3jQFyYTnE8AWOHK1pHvwJpcBBsQ3JhKtRlm8GtV_ekR1HTmcV2bvvDJhtq23-GTLHaeuO2s9AbSJ_fA7L6n8ZHYHa-_sDUHsfwZ8AAAD__8wwBVo">