<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/210960>210960</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Assertion failure on structured binding declared with an explicit array type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
akashagrwl
</td>
</tr>
</table>
<pre>
Clang (assertions-enabled build, trunk) crashes on an assertion when a structured binding / decomposition declaration is given an explicit (non-auto) array type instead of auto.
Godbolt repro- https://godbolt.org/z/c4fjeaPxf
```
typedef int array_type[3];
void f() {
int arr[4]{1, 2, 3, 4};
array_type [a, b, c]{arr};
}
```
Expected: a diagnostic that a structured binding's declared type must be auto or a reference to auto (the declaration is ill-formed).
Actual:Assertion `S.Context.hasSameUnqualifiedType(SubInit[0]->getType(), DestType) && "Deduced to other type?"' failed.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsU0uP4zYM_jX0hUhg06_44IMzWRe9FZj2XMgSbWtXkVJJnkd_fSEnO9NdLGDIAsmPj4_6RAh6scw91GeoL5nY4up8L76JsIrFv5pscuq9fzLCLgh0EiGwj9rZcGArJsMKp00bBfSE0W_2G1CH0ouwckBnUVj8gODryhYFhug3GTefsNoqvWceUbF015sLeo9VLI3wYr_rgIt-4T0bv92MljqmZqyzB7FFl2oK78U7xvcbo7YhslDoZkzeI-QD5MNvTk3ORPR88-6Aa4y3AOUANAKNy915dH4BGv8FGmU1f2Xxx9t8R6evyR9fPqQ6imfUNt4r_50sUJ9LqC9QniEfXpxWOAOdUnfQJhN-j4f6XKXA9lwk4igdZToqaB9w_F9ehPoskntKh7wjU5rvwenyY4Nf3m4sIysoBxSotFisC1FLjKuIv9wBUBserLO6E3ndQsSJdxbReRToeWbPVjJGdzcDneLKP69LG3OYnb-yAuoeCxhk3ISBchg-HgQ0-fPxydnIb_G4ivAsrvyX_WcTRs-a1Z-JUzo9b9PvVkeozznUlwOUXxaODx9Qlzi5cHhYOgRqgBoEogurTaZhHLq4st-ngnIEIqAWZ6ENq2Om-lJ1ZScy7ov2VDVlUzd5tvaqaJuqIzXlp5OsqWPFXVvKsqhkc5qIM91TTk3eUlEQUZUfieuqKahq2mKe27mFKuer0OZozMs1Pa5Mh7BxT0XeNXlmxMQm7NIjkkliqbP6kvk-AQ7TtgSocqNDDJ8poo5m1-suSqgv-EloGmnznJT3C5V9bPdVx_UHMX2qJ9u86X8Sh47rNh2luwKNqY3H73Dz7ivLCDTuYwWg8THZS0__BQAA__8XJWUM">