<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61518>61518</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Initializing a _Complex variable with an initializer list with too many items highlights the wrong item
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue,
clang:frontend,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tbaederr
</td>
</tr>
</table>
<pre>
See:
```c++
constexpr _Complex double d = {1.0, 2.0, 3.0, 45};
constexpr double e[2] = {1.0, 2.0, 3.0, 45};
```
Godbolt: https://godbolt.org/z/P7vqM4dq9
Output:
```console
<source>:3:37: error: excess elements in scalar initializer
constexpr _Complex double d = {1.0, 2.0, 3.0, 45};
^~~
<source>:4:42: error: excess elements in array initializer
constexpr double e[2] = {1.0, 2.0, 3.0, 45};
^~~
```
Clang highlights the second entry for the `_Complex` variable, but it should highlight the first I think.
I have other issues with the diagnostics here, but since this is about `_Complex` and that is a fringe feature anyway, I don't care much about those and fixing the off-by-one error should be enough.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVM1u4zYQfprRZRBDokw5OuiQ2Osih6IF-gAFJY5EthTpJUdJvId99kKSvfEm_QNagz8Wh_zmm2-GVCnZwRM1IB9BHjI1sQmx4VaRphizNuhz8wsRlA-QHyC_jlW-tg7E49yW1S74xPR6ivjrPownR6-ow9Q6Qo1QHhB2j8UmB7FHsU7lOm0l7A5QfkC5niaQjwLkAZffv0f6xnL9_CHoNjiG8gEN8ynNMYkjiOOwGjYhDiCOX0Acf949f_5xqz_Xt0H_NPFp4r9UIvgUHF1Wy30KU-wIyk9QPpRz382OKcYQlz-vHaWE5Ggkzwmtx9QppyJab9kqZ79Q_D9lRZCfvn79U3rbuYt_oqdiVOe_Y_df0_Udw-9Tt457p_yAxg7G2cFwQjaEibrgNZLneMY-xGURqvyqFVQ5PqtoVeto9tlOjJYxmTA5_Qa2HOttTIxPyMb63ze3rp_QqGfCwIYi2pQmSvhi2SzHtFWDD4ltl9BQ_OYmWd_RDJbQJlRtmPg9M-U1slG8bMA-Wj8Q9qR4ioTKn1_UeUZ7Qh08iB1jpyLhOHXmgscmJFpgevtq_bAQCn1_157vgqc1o9doW0LyYRrMJtNNqeuyVhk1RbWrRVnLKs9MU8u8JilUL7dtX3e16nRVtLu8kHWnCtlnthG5KPOyqAspqjzfVJWgXX9f0n0upazuYZvTqKzbOPc8zncqW_RqqkIW95lTLbm0PDdCDCHoi-jLHhACxB6E6OZMQ_nQx-CZvP5guJF8tslDFpvZ3107DQm2ubOJ0xsDtuyoebrW7qyTertN1_JYM6r8bZHjjHRJdQg4Kn9GyzSm93X4EoMfFlM2Rde8e2Esm6nddGEEcZxZXaa7Uwy_UccgjmtRgTguOv0RAAD___2dty0">