<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/101685>101685</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Crash on templated type with address space
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jdoerfert
</td>
</tr>
</table>
<pre>
Clang crashes with a TypeLocBuilder assertion when run on this code (https://godbolt.org/z/or16hfTzf), no other command line options necessary:
```
template <int AS>
using ASPtrTy = void [[clang::address_space(AS)]] *;
template <int AS>
struct EntryTy {
ASPtrTy<AS> Base;
};
```
> clang::TypeLoc clang::TypeLocBuilder::pushImpl(clang::QualType, size_t, unsigned int): Assertion `TLast == LastTy && "mismatch between last type and new type's inner type"' failed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U11vqzgQ_TXDy6gRDAkfDzyQpJFW6sOumvfK4ElwZWxkm0bpr1-Z0G336upKCDxmPs-cI7xXV8PcwG4Pu2Mi5jBY17xLy-7CLiSdlffmoIW5Yu-EH9jjTYUBBZ7vE7_Yfj8rLdmh8J5dUNbgbWCDbjZoDYZBeeytZASqhhAmD3kLdAI6Xa3srA4b665Ap0-gk3VZMVzOnxegGuiAxqINAzvs7TgKI1Erw2inWMWj4Z69F-4eM6ZHSL_eRbo-ixl4nLQIjJAflAnYvkL-_Pg1e2Wu2L7-Hdz5jpAf8cMqiQsU-z7OHFPnrZDSsfdvfhI9A1Xta2xwd4TdEYFayPc_6_-hoA9u7gM-m-DusWK5BiLiVxuQH5YA3AvP35nL4_f5__NF3x-9rlv5zdW6qMfdNPvhr3HSQNUPz39moaN3BN-rT34L8TSbhSMSlQlx8LzF9r9lQ5GeX4QPEb6IYDzH0agAKhCIRuVHEfoBOw43ZoM6eof7xBhXavi2GEClR2UMu9UkoBIvQmmWm0Q2uazzWiTcZCVRkWXFtk6GpkjLopRim5Mos6yr-j6VoqhL0cm061gkqqGUtmmVUrbLtmm9qauyKkVXp2XRlZkUsE15FEpvtP4YIxcT5f3MTZZmRbVLtOhY-0UdRA-kiKJQXBMDnrr56mGbauWD_04RVNCLpB4RuyMeonYWQazskA8IHlp68AsXfiWz080vSlFhmLtNb0egUyyyfp4mZ9-5D0CnpWkPdFr7_mjo3wAAAP__Epsycw">