[Bug c++/96908] New: [c++20] substitution failure if lambda in default template param
bastien.penavayre at epitech dot eu
gcc-bugzilla@gcc.gnu.org
Wed Sep 2 21:56:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96908
Bug ID: 96908
Summary: [c++20] substitution failure if lambda in default
template param
Product: gcc
Version: 9.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bastien.penavayre at epitech dot eu
Target Milestone: ---
code:
```
template<const int * = ([]{}, nullptr)> // 'auto = []{}' would do the same
void func() {}
template<auto = []{}>
void func2() {}
template<class>
void f()
{
func(); //substituion failure
func2(); //substituion failure
}
int main()
{
func(); // ok
func2(); // ok
}
```
output:
```
source>: In function 'void f()':
<source>:10:10: error: no matching function for call to 'func()'
10 | func(); //substituion failure
| ^
<source>:2:6: note: candidate: 'template<const int* <anonymous> > void func()'
2 | void func() {}
| ^~~~
<source>:2:6: note: template argument deduction/substitution failed:
<source>:11:11: error: no matching function for call to 'func2()'
11 | func2(); //substituion failure
| ^
<source>:5:6: note: candidate: 'template<auto <anonymous> > void func2()'
5 | void func2() {}
| ^~~~~
<source>:5:6: note: template argument deduction/substitution failed:
Compiler returned: 1
```
can be tested in godbolt: https://godbolt.org/z/xjTPoj
More information about the Gcc-bugs
mailing list