<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/79367>79367</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc++] std::type_index equality broken for anonymous namespace classes with same name with NonUnique implementation
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aeubanks
</td>
</tr>
</table>
<pre>
https://github.com/llvm/llvm-project/blob/6e4930c67508a90bdfd756f6e45417b5253cd741/libcxx/include/typeinfo#L117 describes the various ways of implementing type_info comparison.
With `_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION = 2`, classes in different anonymous namespace with the same name are considered equal. https://github.com/llvm/llvm-project/issues/44894 already reported this, but the issue was merely worked around for Apple builds.
I believe libstdc++ handles this correctly by not doing the name comparison when it detects these sorts of anonymous namespace classes: https://github.com/gcc-mirror/gcc/blob/aedfdd340cbb4a97a8f6d432720a4df374c1e467/libstdc%2B%2B-v3/libsupc%2B%2B/typeinfo#L205.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlE9v4zYQxT8NfRnEoClKig462EkEGEgco01R9GTwz8hiQ5Fakoqjb19ITuttUSywFxscaKiZ935PIkZzdog1yXckf1yJMXU-1AJHKdx7XEmvp7pLaYgk2xLWENacTepGuVa-J6yx9uPvv7sh-D9RJcIaab0krCmQVxlVRZnTe1FRqVtd5kVbIM_5ppQ5yzOlS76ZLzBSfX4S1hin7KiRsCZNAxrXesKy582mBI1RBSMxQuoQPkQwfoxwEVME34LpB4s9umTcGebW09wLyveDCCZ6tyb0kdDt9fd3kzogBT0973cPx-Pp7Y_j0_7QvJ4eXl-O21_2v74eTvuX4_PTy9Phbfu2fz0AyR6BkYIS9gDKihgxgnGgTdtiQJdAOO-mfp7JiR7jIBTCZX7PPG4UPS51EAFBeReNxoAa8Nso7Bp-WmIT44iRsIbz-4qDsAGFniDg4ENCDakzcR5VjmkZYHkeLiJCjwHtBBcf3lGDCH50GlofYDsMFkGOxur4L7X2INEa_ECwRsakFWE7wnbQCaft4oeJoHwIqJKdQE7gfALtFyu6r71vTsClQwcmgcaEKi1-RoToQ1qs_D8hvxQn2fZHUp2VuutNCD5cDzcUBepW64xTJSUXVSnu20LzjJWMCq7brORqg7woryhed8znLXO2u_vIvsrj8F35P4gymq9Xus50lVVihfWmpMWGVXlRrbq6zbVGKTKlpKB8o3PFlCqKe0k1z5QoV6ZmlHG6YZzRnPFqrTFvKb3HgooC24wTTrEXxq5nDtY-nFeLo3VZZUW5skKijUuIGZuzdHWIMDaHOtQLPHI8R8KpNTHF2zXJJLvE_7u2_BFi0rPG2fYrSxo_r6yaNIEM_h3dAs0PzLrSfyN_OR68-82ZbyPeEiuS8W41BvvzH5p_UrDI8FcAAAD__4XflkA">