<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/73024>73024</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang generates invalid code after exception in dctor
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kelbon
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/nYnvv3EEf
Code without address sanitizer to avoid false positive:
https://godbolt.org/z/qbxMG659h
```cpp
#include <vector>
inline bool g = false;
struct X {
int i = 0;
~X() {
if (i == 1) g = true;
}
};
struct Y {
~Y() noexcept(false) { throw 0; }
};
X f() {
try {
Y y;
return X{1};
} catch (...) {
}
return X{};
}
int main() {
f();
if (!g)
return 4;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyElE9vozAQxT_NcBk1sk2AcODQNs2e9p4cjW3Au46dtQ39c-hnX_FHDWm72igCyZ733s8wAw9Bt1apCrIHyPYJ72PnfPVbmdrZpHbytepivARI74EdgB1aJ2tn4sb5FtjhDdjBnuwwpE9PDZA9kPv5-uikwmcdO9dH5FJ6FQIGbnXUb8pjdMgHpyU23ASFFxd01IMaU1Ym_0v-U7_8_JFnZbcWQU7mv7hcbtZZqq0wvVQI6eOgRHQe0qd1ibZGW4W1cwZbhHQ_40H6sK4K0fci4hGhWNYREbWNqCcN-VQ_7r4fge2AlbeaSdcgsN2kHMV0LJqzo--v0QjFfjEt9h-rC8rp1vb9tIRZp16EukRgu_kgMwDGzrvnifN72yM23-FG__qV_4SvV8jl51XsvcUjFA907TvuQbFHwaPoxmNvNpsvKR9En5zWRlfq5b1FPHNtv4NeTnLDMD9zYLQdd1boS9z2X0EfvZXIKpVlWvJEVbQgJCtpQVnSVXVNSlkSynKhspQ2XOxyTspdxjImBK0TXTHCUkoZpbs0o2yTN4Xc1jzPckE4kTlsiTpzbTbGDOex2RMdQq-qIiVsmxheKxOmaWVMGG5bYGwcXF-N9Xd13wbYEqNDDFeHqKNR1VSOrbLK86gCajtwoyWKcVZ5E5XHuV-0s6gtynFEkt6bz58AHbu-3gh3BnYYM5bb3cW7X0pEYIcJOQA7TNR_AwAA__8mFzPD">