https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102644
Bug ID: 102644
Summary: deduction failure when having default non-type
template parameters that are lambdas
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
gcc trunk with -std=c++20 rejects this example as having no matching function
call:
template <auto V1 = []{ return 0; }>
struct s {
template <auto V2 = []{ return 1; }>
int foo() { return 0; }
};
int main() {
return s{}.foo();
}
gcc accepts if:
* foo()'s default argument is 1 instead of a lambda
* s is not a class template (but changing V1's default to be 0 while keeping V2
as a lambda is still an error)