https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106211
Bug ID: 106211
Summary: Rejects valid with function template with non-deduced
parameters from deduced parameters of another function
template
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: davidfromonline at gmail dot com
Target Milestone: ---
The following valid translation unit
```
template<typename, typename>
concept any = true;
void f() {
[]<typename... Ts>(Ts...) {
return [](any<Ts> auto..., auto) {};
}(0)(0, 0);
}
```
is rejected by gcc with the error message:
```
<source>: In function 'void f()':
<source>:7:13: error: no match for call to '(f()::<lambda(Ts
...)>::<lambda(auto:1 ..., auto:2)>) (int, int)'
5 | []<typename... Ts>(Ts...) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 | return [](any<Ts> auto..., auto) {};
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 | }(0)(0, 0);
| ~~~~^~~~~~
<source>:6:24: note: candidate: 'template<class ... auto:1, class auto:2>
requires (... && any<auto:1, Ts>) f()::<lambda(Ts ...)>::<lambda(auto:1 ...,
auto:2)>'
6 | return [](any<Ts> auto..., auto) {};
| ^
<source>:6:24: note: template argument deduction/substitution failed:
<source>:7:13: note: candidate expects 1 argument, 2 provided
5 | []<typename... Ts>(Ts...) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 | return [](any<Ts> auto..., auto) {};
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 | }(0)(0, 0);
| ~~~~^~~~~~
Compiler returned: 1
```
See it live: https://godbolt.org/z/c7zxWEbxM