<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95154>95154</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++] namespace extending namespace inside inline namespace mangled as if it wasn't inside the inline namespace
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MitalAshok
</td>
</tr>
</table>
<pre>
```c++
#include <typeinfo>
inline namespace inline_namespace {
namespace extended_outside {
struct Y;
}
}
int before = __builtin_printf("%s\n", typeid(inline_namespace::extended_outside::Y*).name());
namespace extended_outside {
struct X {};
struct Y {};
}
int main() {
__builtin_printf("%s\n", typeid(inline_namespace::extended_outside::X).name());
__builtin_printf("%s\n", typeid(inline_namespace::extended_outside::Y*).name());
}
```
With Itanium name mangling, this currently prints (clang trunk: <https://godbolt.org/z/45d9dsfz9>)
```c++
PN16inline_namespace16extended_outside1YE
N16extended_outside1XE
PN16extended_outside1YE
```
When it is expected to print (and does print with GCC):
```c++
PN16inline_namespace16extended_outside1YE
N16inline_namespace16extended_outside1XE
PN16inline_namespace16extended_outside1YE
```
This also applies to mangling of function/variable names if they physically appear in the second time the namespace is opened outside. Seems like the scope isn't calculated properly (it should be the same as if it was `namespace inline_namespace::extended_outside {`)
Relevant standard quote: https://eel.is/c++draft/namespace.def.general#2
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVU2P2zYQ_TXUZRBDGlmyddDBseOihwZFW6C7pwUljix2aVIlqd04v74gJe96HS-QHoIAhCyTM6P33nyQOycPmqhmxUdW7BI--t7Y-jfpudq43jwmjRGnmpXptFqGH8NKdyzdMMylbtUoCFi-9aeBpO4Myz_Nx_EptZKaQPMjuYG3BNPGw-sGW83xAODCjr540oLEgxm9k-LSznk7th7uWX7hyVa7-bsvLzMADw11xgaUO3h4aEapvNQPg5XadwzXDJFh4Vix1fF1C5GLYLi-BsvyDcs319Cm3XuGG4bVIhjHqFVYZ4jT87voAZwZ3sXd1e4N0TP767MbvI9c6gnK2_A_ToS79xX4edK_CHMu40ud_pa-h18913I8xvKDI9cHJfUhwumlg3a0lrRXJ4jAHTBct4rrA3g76keWb0ID9N4PLuDBPcP9wYjGKL8w9sBw_5XhflmISrjuaxU6BKtLDLf76_fPWXmtQlZeK5Ddz_32-cbZ3afXUO863palJw3Sg3RAXwZqPQnwZhIg8OdagDDk5p3noOIv223UffMjuH2H9SXb_xH8Jv-_QuK5cgb4MChJLrA_VwaYDrpRt14azXD_xK3kjZqnHMgOfE8nGPqTky1X6hRiELcgdTgBR63RArw8Uvx_MRwdmIE0CZhBLuBPoqMDJR8nW9eaIdhphisPLVftqHhIzmDNQFadQnKkB9ebUQloZq9Q1zxCkx6euQNWpu_P5Nu9FmdImV7V7h-k6IlrD85zLbgV8O9ofAgBbzuCSC2kY7ifC0FY3nmG-5evLgR1iwNpslwxzDERdS6qvOIJ1dkqW2e4XqeY9DU1nHNBxRKrFssyR0rXads2q4LniF2ZyBpTXKZllmXrNE1xgVWXBpsMl0VJWcWWKR25VAulno6hRxPp3Eh1VWTFMlG8IeXinYio6RniYRhQxS6xdfD50IwHx5apks671yheehUv0-1c7MXumyst1M-l9FHab67JWGok3iRtyvnsEdJ67ZWMVtVXc0j6fmwWrTky3Aec88-HwZp_qA0JiOxCYib2TzX-FwAA__-etYfV">