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

    <tr>
        <th>Summary</th>
        <td>
            [crash][clang] Crash when instantiating out-of-class defined class template.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Minimal repro:
```c++
template <typename>
struct X1 {
  template <typename>
 struct X3;
};

template <>
template <typename T>
struct X1<int>::X3 {
 void x3() { }
};

int main() {
  X1<int>::X3<int> x3;
 x3.x3();
}
```

Godbolt: https://godbolt.org/z/Y7roheqcz
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0UsGOmzAQ_ZrhYgXZHkzgwIFNSk-99bA9GnDAlbFT26S7-_WVSdJ0V1vJEubx5r15w8gQ9GSVakA8gThmco2z880wykEu0me9G1-bb9rqRRri1dk7wBZoCyW9ngH4Uzq0jWo5GxkVATzE17OyclGAX4C2Ifp1iOSZEdgnJiH_55I7GQETF_bH2-W9w5X9mQ75_sEV8KBtTCC2gO0z3tu4OD2SFwReAa8TSJLbe09tI1mktg_SFuAT1b9AktzKyQvmd_lHmn-Gd7X46sbemQjYkjnGc0iCvAPeTdcPufMT8O4NePdj792sfg1v2djgWGMtM9WwvRAVLZGV2dxIHLAqenEqaV_yumKsRiWkYLKoJWdVphtOuaAVZ6wWFZa5ooXaC4FVRU8MTyMUVC1Sm9yYy5K8Mx3CqhomigpZZmSvTNj2hfPBSDsB52l1fJMKdv06BSio0SGGh0TU0WxLNngZZhDHdN2KxZEcEkZ-z8oSbUOUNmoZtZ2IW-POnXaDkSGQUZ20VSO5vt3_fJ6t3jQf5qbjvPb54BbgXWrh9tidvfuphgi82yIF4N0t1aXhfwIAAP__VE_mlg">