| Issue |
238014
|
| Summary |
[clang] Misleading failure after error recovery
|
| Labels |
clang,
clang:frontend
|
| Assignees |
zyn0217
|
| Reporter |
rupprecht
|
Regression bisected to #233375
Given this input (not expected to compile):
```cc
void foo(int);
void extract(int*);
template <typename T>
void test() {
using Type = decltype(foo(T{}));
extract(Type{});
}
struct Bar {};
void run() { test<Bar>(); }
```
It used to be that only the first issue was diagnosed:
```cc
<source>:6:27: error: no matching function for call to 'foo'
6 | using Type = decltype(foo(T{}));
| ^~~
<source>:12:14: note: in instantiation of function template specialization 'test<Bar>' requested here
12 | void run() { test<Bar>(); }
| ^
<source>:1:6: note: candidate function not viable: no known conversion from 'Bar' to 'int' for 1st argument
1 | void foo(int);
| ^ ~~~
1 error generated.
```
Now there is an additional warning that is IMO confusing:
```cc
<source>:6:27: error: no matching function for call to 'foo'
6 | using Type = decltype(foo(T{}));
| ^~~
<source>:12:14: note: in instantiation of function template specialization 'test<Bar>' requested here
12 | void run() { test<Bar>(); }
| ^
<source>:1:6: note: candidate function not viable: no known conversion from 'Bar' to 'int' for 1st argument
1 | void foo(int);
| ^ ~~~
<source>:7:5: error: no matching function for call to 'extract'
7 | extract(Type{});
| ^~~~~~~
<source>:2:6: note: candidate function not viable: no known conversion from 'Type' (aka 'int') to 'int *' for 1st argument
2 | void extract(int*);
| ^ ~~~~
2 errors generated.
```
The `no known conversion from 'Type' (aka 'int') to 'int *' for 1st argument` is confusing/misleading: `foo` returns `void`, not `int`, so why does clang think that `Type` is `int` instead of `void`?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs