<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63670>63670</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Optimization problem
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kelbon
</td>
</tr>
</table>
<pre>
```C++
#include <vector>
void foo(const std::vector<int>&) noexcept; // 1
//void foo(std::vector<int>) noexcept; // 2
//void foo(const std::vector<int>) noexcept; // 3
void bar() noexcept {
const std::vector<int> v;
foo(v);
// foo({}) // 2
// foo({}) // 3
}
```
While it is undefined behavior to modify 'const' variable compiler(clang) do not optimizes dctor in this case, its really strange for me
https://godbolt.org/z/WjovodEY3
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU89ymzwQf5rlshMPrLCBA4fECdfvmPmOAi1GqZA8SNA6T98R2K0nU7eMBpB29fsHkt7rk2WuYf8C-9dEzmFwU_2NTets0jp1qeGQbuMI9BJH-grpM5DQtjOzYgRxXLgLbgLxdi2u98Vphb1zQGXnrA_ogwLxDOL51n7UNsRNdACq0Dr-0fE5gHhBRKAGqMHsRhdnd4iPsb4CbdcVjh7A_UvgA3XizmkrJ6DyvhWhuKYVFfydAhcQt-ZN0gJU_Vq78m2VCFu8RqY_uXrUdNUaF7eX23fdpu-DNow6oPY4W8W9tqyw5UEu2k0YHI5O6f6CQMVqBajARU5atoaxc-NZG44JdEbaU-RVDq0L6M5Bj_qTParoGLXFMGiPnfQMdEQdPE4sjbmgD5O0J8beTTjy_b80hHD2MbjVy8mp1pmwc9MJqPkEat4_3OLU2_8iUbVQlahkwnV2KMu82u9FmQz1_lBQ2ivKM8EqZ8kZp30lc9F2qsqLKtE1pSTSIs2zUlBW7tpCUFVlfZbmFUtBkKc8Sm12xixj5E609zPXB3Eo0sTIlo1fzxGR5e-4FoEoHqupjnue2vnkIU-N9sH_Rgk6GK7_22KSQTuL58m1hsdknkz9xboOw9zuOjcCNRHi-ng6T-6DuwDUrMQeqFmF_QwAAP__Iqoltg">