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

            Bug ID: 101921
           Summary: G++ cannot find a template function with lambda as
                    default template argument
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

Compilation of this valid code:
```
template<class T = decltype([]{})> void bar() {}
void foo(auto) { bar(); }
```

results in error:
```
error: no matching function for call to 'bar()'
    2 | void foo(auto) { bar(); }
      |                  ~~~^~
note: candidate: 'template<class T> void bar()'
    1 | template<class T = decltype([]{})> void bar() {}
      |                                         ^~~
note:   template argument deduction/substitution failed:
```

Other compilers accept it: https://gcc.godbolt.org/z/9GsPo8Pnb

Reply via email to