<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/120033>120033</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Compilation Hang Issue with Deeply Nested Template Instantiation in LLVM-18 and Trunk
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
iamanonymouscs
</td>
</tr>
</table>
<pre>
This hang can be observed in both LLVM 18 and LLVM trunk versions.[https://godbolt.org/z/dKPhr395q](https://godbolt.org/z/dKPhr395q)
# Command
`clang++ bug.C`
# Code
```cpp
template<template<int N, int M> class>
struct A;
template<class U>
struct B {
template<class T>
struct C {
template<template<auto X, auto Y> class TT>
using type = A<TT>;
};
};
template struct B<>;
template<class U>
struct C {
template<class T>
struct D : C<typename B<T>::template C<T>::type<int>::template C<T>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type<int>::type>::C<int>;
```
# Version
`clang++ --version`
```sh
Ubuntu clang version 18.1.8 (++20240731025011+3b5b5c1ec4a3-1~exp1~20240731145104.143)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzslU_Pm0YQxj_NcBmB9g_Y-MABcFCjJlEPTtSeqgU2sO2yUHZ587qHfPZqATt-E1Wt2mskJA-zvxk_A-IZYa3qjJQZJAUk50Asrh_nTIlBmNFch3GxjQ3qsb1ml15Z7IXpsBEGa4ljbeX8JFtUBuvR9fjmzYe3SFMUpt1iNy_md3ySs1WjsREkRe_cZIHnwCpgVTe29ahdNM4dsOpPYFX740_9zE_JH5CcgaX_HmcnILm_GMdyHAavwd8eSKOF6YAVwAqsly4q4UAe2VZu3HY10wQkd3KYtHASePkQKuPwHbASffAW-CtstLAW-CsguXXz0jjMgRdb94fCFcP3L8AC4ehJxG_AywbiTpZ38gX7EIrFjfizV7ZGv9yl4eXWCxEXq0yH7jpJBH72SsvtmG_d4Xjexd-DL1PcxBTAy3vNP0951_63Q94anxF4jqUf7DpJIwa5_tcmMAf-RUn5Mn2d9nfzX8jvqe-p_5Hab8qHw-LRTXaT-bA54Ld-FIa7Oe7src72QPL39WLcgit_M1GkaUSjFIGlWwtGWEyOnBKWEEqBFbxO6qShsokFD-ln-TzRzzeIxgklcURjvvnlRcyddP67e04Pvx7icGpCrczyHHZm8ef9LEWLw9hK7alptOoZSP7aWCe0lu1ZzT4PrFrsDKyqlflq_KDNeHviJxHIjB55zGl6TFnQZ4djmtDmkPKYUpmcGE3ExzipaVMnXNSCBirzsimjB8IpJyyqeZMeBaPiY3w8tUkLMZGDUDrS-mnwSyFQ1i4yo4wQzgMtaqntutgYM_ITrqfAmN9zc-aLwnrpLMREK-vslzZOOS2zchwmpYXzT_0H_wpe-3r8pFyPZyknfcV30jrZ4uXmN-tzMU5tRcqsWzDcN-LFL8NgmXX21VZTrl_qqBkHYJXXsP-E0zz-JhsHrFqVW2DVPtpTxv4KAAD__740R_Q">