https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93595
Bug ID: 93595
Summary: [c++20] Substitution failure of "auto = []{}" in
template parameter list in nested template context
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: ---
godbolt link: https://godbolt.org/z/GC3eVG
The following, valid c++20 code, fails to compile.
template<auto = []{}>
static void f() {}
template<int>
struct bad
{
template<auto = []{}>
static void f() {}
};
int main()
{
f(); //works fine
bad<0>::f(); //substitution failure
}
It produces the output:
<source>: In function 'int main()':
<source>:14:15: error: no matching function for call to 'bad<0>::f()'
14 | bad<0>::f(); //substitution failure
| ^
<source>:8:17: note: candidate: 'template<auto <anonymous> > static void
bad<<anonymous> >::f() [with auto <anonymous> = <enumerator>; int <anonymous> =
0]'
8 | static void f() {}
| ^
<source>:8:17: note: template argument deduction/substitution failed: