<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/162758>162758</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] typeid() can only be used with <typeinfo>
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mikomikotaishi
</td>
</tr>
</table>
<pre>
When compiling a translation unit that calls the `typeid()` operator, the compiler will compile the file only if `<typeinfo>` is `#include`d. It will not compile when using `import std;`, for example, without any `#include <typeinfo>`.
I imagine this is not intended, as cppreference states that a program is ill-informed if it calls `typeid()` without `std::type_info` being visible, if a translation imports a module that re-exports `std::type_info`, it should in theory still work, yet it does not.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0k89y2yAQxp8GXXbswWBh-6CDk9QzeYIeO0ispW0QaGAVx2_fQUr6J20PGgmx--PbbxebM_UBsRH1g6ifKjvzEFMz0kssD1vKA1VtdPfm64ABujhO5Cn0YIGTDdlbphhgDsTAg2XorPcZeEAQRvJ9QnJCHYU6CSMhTpgsxyTU4xKy4jDBjbz_WC071_IRg78DXQtJ6McFFq5R6C-FRXn5rzSFzs8OhZFuC8-8skLkn7xbUT7noloYSeMUE0NmJ_TDQniEa0yAb3acPJbljXiIM4MN9z_PgL9kbIU8C3l-BhptT6GIp1y0FQEUGINDV5g2QzdNCa-YMHQImS1jXj2zMKXYJzuWRPJ-U_hpRFeKpw9P_-Hnh1Bh5FLPWehzifm2CDQSWixVv1Kmdi2Nrp86t9qRwcIY3by4bxkSbvBt3fgfe6Ex5CHO3gGF0raY7pC5-H-L6aVE3JFLlIu4WLKtXKPdSZ9shc3uYKSsj1qpamiMrg_dcd9pVAetD8YpbYxzRyPb1lmzq6hRUtU7uZNyJ2ultnt3UtrYujtae7WdFnuJoyW_9f513MbUV5TzjM3OqEN9rLxt0edl0JXqvA29UKrMfGpKwqad-yz20lPm_AvBxH65HWtG_QS_9wA6G9YpbRHmjG7pyKcpqebkm4F5ysVEdRHq0hMPc7vt4ijUpZz1_tpMKX7HjoW6LNqzUJd3-a-N-hEAAP__zrQ12g">