<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65232>65232</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
C++ namespace aliases - does clang copy? reference?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
timprepscius
</td>
</tr>
</table>
<pre>
Hey there,
I'm wondering how clang handles namespace aliases. I realize this is partially off topic.
Let's say I had this convoluted (but to demonstrate an idea) code:
```
namespace project {
namespace enclosing_namespace = project;
namespace namespace_1 {
namespace parent_namespace = project;
namespace enclosing_namespace = namespace_1;
namespace b {
namespace parent_namespace = namespace_1;
namespace enclosing_namespace = b;
struct X {};
struct Y {
using Z = enclosing_namespace::X;
} ;
}
}
namespace namespace_2 {
namespace parent_namespace = project;
namespace enclosing_namespace = namespace_2;
namespace a {
namespace parent_namespace = namespace_2;
namespace enclosing_namespace = a;
struct X {};
struct Y {
using Z = enclosing_namespace::X;
} ;
}
}
}
int main()
{
project::namespace_1::parent_namespace::namespace_2::a::Y::Z z;
return 0;
}
```
Are all of those namespace references, essentially for free with clang? Or am I forcing the compiler to make a ton of copies that will cause memory problems etc.
Thanks in advance!
-tim
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVcGO4jgQ_RrnUmqU2CQhhxy6G6FtaaW97GFmLqOKUyHecezIdhoxX78y0AS6mRHaWWkQik2Vy--l6lGF3qutIapZ_sTydYJT6K2rgxpGR6OXavJJY9t9_QftIfTkiPFnlq5Z-nh8vjBeDrCzpiWnzBZ6uwOpMe7QtJo8GBzIjygJUCv05BcAL-AItfpOEHrlQXkY0QWFWu_Bdh0EOyq5uMT5kwLjpQePe3iBHttjpLTm1eopUAuMr5opQLDQ0mCNDw4DARpQLSHjFUjbEhOn-1iRnr4XIDPV0dl_SAZg5dPRBQAXb0JGauuV2X6dbUys38KYuIi6FX_efc2uIa6PjejIhDsw7mN3gfoDhtf3NB-53cHvRyj382xuxn20-OAmGeDTgWa5vhl1OvP59qvEzxQZwJcD8g1GUTHi8dNtSuUaZkekMOf06sdPJcB_iwT4XRLAX5QA_48SwJ-w-4XS_2-1no3viz9vDk9lAgyoDOMrxqu3I2_XnAsZca_-ONHwPrfvj_GjAY_L5-PyBb6faZ5QHIXJGUhn-5njrS746GKr1mA7CL31F1IFRx05MpI8489A3pM5de3OOugcEexU6I8TgIkNwF8OcICX6Jcx96EnkHYYlSYXe_WA36LKgjURT9pRkYfQY4Cd0hokTp5goMG6fcxWo2nwQOF6OPzdo_nmQRnA9hWNJMazS_9DUEPS1qKtRIUJ1VlRibJMl3mR9DXP8yzvVlklujxdynRVFCjSTKwq4mVTFomqecpFWqUiq5alKBZ5luYos3IlBJcVcrZMaUClF1q_DgvrtonyfqK6yLngicaGtD8MWM4N7eDgZJzHeevqGPPQTFvPlqlWPvj5lqCCpvqZ8SfGnz7OUXiA1pI_jVtpx33M-LlETGySyem6D2H0URt8w_hmq0I_NQtpB8Y3Eem0PLxJkW8O_DzjmwP_fwMAAP__CD1kKA">