You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code using a lambda to capture a reference to a function rejected with could not match (null template argument) against (null template argument)Β #84961
<source>:7:9: error: no matching function for call to 'g'
7 | [t] { g(t); };
| ^
<source>:7:7: note: while substituting into a lambda expression here
7 | [t] { g(t); };
| ^
<source>:14:3: note: in instantiation of function template specialization 'f<void ()>' requested here
14 | f(h);
| ^
<source>:2:6: note: candidate template ignored: could not match (null template argument) against (null template argument)
2 | void g(const T& t) {
| ^
Changing the call g(t) to be either g<T>(t) or g<void()>(t) changes the error message to:
note: candidate function template not viable: 1st argument ('void (const()') would lose const qualifier
Note that the type mentioned here (void (const()) has unbalanced parentheses.
Workaround: change the lambda capture from [t] to [t=t].
This code was accepted by clang 3.0.0 but is rejected by all version from 3.1 to the latest trunk currently available on Godbolt.