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

            Bug ID: 103807
           Summary: Unable to make template class instance with default
                    parameter of lambda::function
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

Below code:
```
template <auto x = +[]{}>
struct A {};

int main() {
    [[maybe_unused]] A x;
}
```
is accepted by Clang and MSVC.

But GCC prints the error:
```
error: class template argument deduction failed:
    5 |     [[maybe_unused]] A x;
      |                        ^
<source>:5:24: error: no matching function for call to 'A()'
```
Demo: https://gcc.godbolt.org/z/4azGT5fso

Reply via email to