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

    <tr>
        <th>Summary</th>
        <td>
            Excess elements in X initializer diagnostics should print the name of the intialized object
        </td>
    </tr>

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

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

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

<pre>
    Created per a review comment from @ilya-biryukov: https://reviews.llvm.org/D129531?id=479758#inline-1344941

For the following code:

```cpp
struct S {
    int i, j;
};

S s{0, 1, 2};
```

Clang currently outputs the following diagnostics:

```
<source>:5:11: error: excess elements in struct initializer
S s{0, 1, 2};
          ^
1 error generated.
Compiler returned: 1
```

The error message should print out the type that is incorrectly being initialized.

This is necessary because in situations such as initializing base classes or templates, having this error message without the type make it difficult to determine which type is being incorrectly initialized.

See: https://godbolt.org/z/r53brnc5E
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVEtu4zgQPQ21KSQQScmyFlo4cXyBzGK2FFmyqpsiBX6ScU4_oO3ETjd6MIJAUYX6vPdYRRUjHR3iwNon1u4rldPsw6Csch-z8rwavTkNzwFVQgMrBlAQ8I3wHbRfFnQJpuAXYE1N9qQeRgqn_NO_MbmDOaU1Mrlj4sDE4RIVH619Wx59ODJx2HPRt5IzeSDD5L7p-q7dMiHJWXL4wGXT9A1n9Z7Vu8t68AHSjDB5a_07uSNob7DUuHNim_ry6nW9WGIKWSd4BdY9XSwAAOQSEBPP8IPJq5l1-9v-vL5CZN1TXdx4WcQ3l89K9xHPVhVcOQR0yZ7A57TmFH_BbUgdnY-JdPwT_OuvfI4-B41MvjC5a5nccV7kxRB8OG_-0RgjoMVyHhHIwZUwOUqkLH1g-B9s4Oth7cvFxC9V4IgOQ2mBxytHv6xkMUDAlINDU3Dw_xDlrxmvqRaMUR0R4uyzNbCGcgw-p7M-6bQipFkloMJD-xBQFxFHLKLd-HwC-cxe3CM4LEqoUPy1yhHPWlDKKpF3EWLWM6h4y1OSjioiaKtixAilv3BZrUoYi0Czeis-qRT4jv-d0vwN9qJ-IlACQ9NEOtsEyYPBhGEhh_A-k54vnhS_-NwY_onbK-Lvw3T0ZvQ2Xefoo4xXK8fgdPtSmUGaXvaqwoFvulpueNs11TwYNentVHe94duuxg2apm-3aPrthC32XUWDqIXgot4IznvZPJpu00-IQqpGcKMla2pcFNmvGa4oxoxD28tNV1k1oo3ni0QIXYaAyd19mwtRbpgwlOiHMR8ja2pLMd3uhCpRsji8_N7Qf9_38v3wfO-jchhOLQh-Ou_JfWoKfvyBOlU52OEXLSnNeXzUfmHiUJBcPw9r8CWEicOZZmTicGb6bwAAAP__73ulXw">