<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58301>58301</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang crashes if dependent template name with no `typename` keyword instantiates to an alias template
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zygoloid
      </td>
    </tr>
</table>

<pre>
    Reduced testcase:

```
struct A {
  template<typename = int> using B = void;
};
template<typename T> int n = T::template B<>;
template int n<A>;
```

This is ill-formed: `T::template B<>` is assumed to name a non-type template when parsing the `n` variable template, but during instantiation is found to name an alias template. Currently [clang crashes](https://godbolt.org/z/GzW864Yxz) rather than properly rejecting.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1U8uu2yAQ_Rq8QYkwjh1n4UUevd1XkaouwYxtWgIR4KTJ13dwbh69t5UwBmbmzDkHWzp1ab6BGltQNEKIrQhAijVhO8Luc8Xex7QN0Y9tpGtKlpvbCcXKw9GIiJXbeDmCFQegpNhRbSMpvtAxaNvTzXR0clqR4r2SLHeP9b8w9qkaQaidaveJWfHIpBvMxYxPELcSDK5fox903Ob9oANNw5hZ5_wBkBxKq9j_elUspYsQxkOyzNGJqKDW2Vni_fCCngew9Cj8JD4OkFBtqj8Jr4U0z1TCt1SOkarRp1xtQxQ2ahG1s6lb50b70stSYbQIj_I53Y7eg43mQkm5aY1AkNaLMEAg5Y7weojxGJIg_oajd0o6E-fO97i74vP1-r2uFj9-43pFvUCyHhljo6N3R_CI6-EntBHZzTNo8qoqS85LVmeqKdSqWIks6mig-as31R1VgFepkNvTl0nEWccBPUue3G87WfMLLmfn1YsFCIPCP2nORm-aD7IQcpTz1h1wY8zp_pqhiEQetxqvDT3hb2VdsDwbGl7WrIaFXMhCiW6VK-iWy6Krl6yrRcXzzAgJJjRoK-HcwplOELhGYzPdcMZ5zvIcp5rXc1lLxtq6YkJ2ciFasmBwENrME4_kd-abiZIc-4BBo0MMzyB-Vbq3AFM7xBdjHJxvrpfeGfxtsql3M3H_A5hhMBM">