[clang] Redundant error message for `auto*` in structured binding
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```c++
struct S {
int *p, *q;
};
void f(S s) {
auto* [x, y] = s;
}
```
```
:10:11: error: structured binding declaration cannot be declared with type 'auto *'; declared type must be 'auto' or reference to 'auto'
10 | auto* [x, y] = s;
| ^
:10:11: error: variable '' with type 'auto *' has incompatible initializer of type 'S'
10 | auto* [x, y] = s;
| ^ ~
```
The second error seem unhelpful and redundant.
https://godbolt.org/z/54h3jq6Eo
Contributor guide
Research direction
Start by compiling the provided reduced C++ example with Clang and inspect the structured-binding semantic diagnostic path. Confirm the redundant incompatible-initializer error is emitted after the invalid `auto*` type diagnostic, then add or update coverage so the example reports only the useful error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100