<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/90107>90107</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Decomposition Declaration diagnostic for missing initializer is pretty unclear
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue,
quality-of-implementation,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
erichkeane
</td>
</tr>
</table>
<pre>
Given the following code:
```
#include <utility>
std::pair<int, double> MyFunc();
void foo() {
auto [A, B] C = MyFunc();
}
```
Our diagnostic is just:
```
<source>:9:10: error: decomposition declaration '[A, B]' requires an initializer
9 | auto [A, B] C = MyFunc();
| ^
<source>:9:16: error: expected ';' at end of declaration
9 | auto [A, B] C = MyFunc();
| ^
| ;
2 errors generated.
Compiler returned: 1
```
https://godbolt.org/z/h9zKT5zGe
No compilers are particularly good at this diagnostic, but all the others at least highlight the `C` as the mistake, whereas Clang's error is pretty opaque/points at the opening bracket.
I'd prefer we move the 'arrow' to the position where the initializer is expected. Additionally, some improved diagnostic wording that highlights what went wrong better would be appreciated.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyclMFy4zYMhp-GvmDikcg4ig46OHa80-m0vfQFKBKSuKEEhQTjOk_foZxstJnsofV4JJEgyA_AD-oYXT8hNmL3IHbHjU48UGgwODM8oZ5w05K9NN_cC07AA0JH3tPZTT0YsijUXhRHUbw_74q3_3UolZuMTxZBqENi5x1fhHpcu0S2eRO1n7ULQh3cxEIewFJqPQr1CH9cTmkyQt4LWQv1sPZ9IWehI7oaQVRvVgAAnZhA7B72ebccGhxAqOMvtquOXwewPP9KAazT_USRnQEX4XuKLNQevnZSh0gpmEwv1L4Wal8WeTWGQCF_WDQ0zhQdO5ryyOugl28hqzWzkBUEfE4uYAQ9gZscO-3dK4aPSHPgB_jPMS8ei6vYPf6a_O4ncvxnRsNoF1D1kPk0A04Wq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