https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93154

--- Comment #2 from DB <db0451 at gmail dot com> ---
A reduced version, without a variadic pack of functions...

```
#include <concepts>

void f1(int) {}

template <typename F>
auto
make_lambda(F f)
{
        return [f] <typename Arg>
                   requires std::invocable<F, Arg>
               (Arg a)
        {
                f(a);
        };
}

auto
main() -> int
{
        auto const lambda = make_lambda(&f1);
        lambda(42);

        return 0;
}
```

...gives an error that is now specific, but which still seems clearly wrong:

>>>
test5.cpp: In function ‘int main()’:
test5.cpp:19:11: error: no match for call to ‘(const make_lambda(F) [with F =
void (*)(int)]::<lambda(Arg)>) (int)’
   19 |  lambda(42);
      |           ^
test5.cpp:9:9: note: candidate: ‘make_lambda(F) [with F = void
(*)(int)]::<lambda(Arg)> [with Arg = int]’
    9 |  return [f] <typename Arg> requires std::invocable<F, Arg> (Arg a)
      |         ^
test5.cpp:9:9: note: constraints not satisfied
In file included from test5.cpp:1:
/usr/include/c++/10/concepts: In instantiation of ‘make_lambda(F) [with F =
void (*)(int)]::<lambda(Arg)> [with Arg = int]’:
test5.cpp:19:11:   required from here
/usr/include/c++/10/concepts:344:13:   required for the satisfaction of
‘invocable<int, Arg>’
/usr/include/c++/10/concepts:344:25: note: the expression ‘is_invocable_v<_Fn,
_Args ...>’ evaluated to ‘false’
  344 |     concept invocable = is_invocable_v<_Fn, _Args...>;
>>>

It looks like the compiler is mixing up the template arguments of the outer
function and the inner lambda.

In that sense, this might have the same root cause as
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93152

Reply via email to