<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62333>62333</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang++]: Fails to export destructor symbol for type encapsulated in anonymous union
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JavierJF
</td>
</tr>
</table>
<pre>
## Affected versions
All tested versions, from `16` to `4.0`.
## Description
Under certain conditions, `clang++` leaves the symbol for the destructor of a struct contained in an anonymous union as `undefined`, this cause later issues at linking time. Here it can be seeing the offending symbol from the provided example:
```
xpsdev ➜ clang_issue nm -a lib.o | grep non_dtor
U _ZN10non_dtor_tD1Ev
```
## Reproduction
* This is a minimal reproduction example on compiler explorer: https://godbolt.org/z/KbMzohnjW
* This is the minimal test case: [clang_issue.tar.gz](https://github.com/llvm/llvm-project/files/11313531/clang_issue.tar.gz)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlMFu4zYQhp9mdBmsQJE2Yx10cOIIxRbtoeiiQC8BJY4kbilSICkjydMXlGPUTveyBkFrMOT8w4_6pWI0oyNqYP8I-1Oh1jT50HxVZ0Pha1t0Xr81wAVwgcdhoD6RxjOFaLyLwE7Ajpf5aC0mindp_oRD8DOCZJUEyTD5_LwrGUhW3u7-UDhR7INZkvHuNvvNaQrYU0jKOOy90yZdBUCy3io3An_MQzK0pM4UMU2E8W3uvMXBhy3UFFNY--QD-gEVXqJcMBcmjcahysO7t9mvEVdnvEMVs8rqNA15FUiWhdNkIvZqjYRWJQpoYlwpokpojfvHuBGTmanEXygQmoS9ctgRRqItNxH6YSCnc3RtNNPKmSX4s9GkkV7VvFgCcbzDJdnH2MLXJWo6IzxzqJ-hfkLckLxsHaGb8YtCa7rSIzw84RhoQefdi04-XArg5983fPn794pdV72kU_V8_qH23f39QUvweu0_XyDwI_6ZeZmICmfjzKwshpvV14Oizxc8L8ZSQHpdrA8UQBxxSmmJGQNvgbej1523qfRhBN6-A29_7X5795P7_tf_FTPQq2Z-RbFXMRNFhP3jDakyqVCO77A_AT980jNpWruy9zPw1trz9e_LEvx36hPwdjCWIvC2qkQl9qIC3v6gNq_vuGxzoRuha1GrgppKHriQFd_xYmoOD1IcKn3oNGeslsNQdbo_KPEgRd1p0oVpOOOC7fiuOogd4-VDrSQT_WEn6j3vBgk7RrMytszNZlrF1k0juRCisKojG6_WD812om4dI-yYNTHF_7Ylk-z2kbg12_6UKbbK2JitTa-LD-nWZbf-e1sIyfVqiWv2y4fZ7pxWrME2Pw3-4jvg7XaofwMAAP__EdSGHQ">