c++ - Lambda as default argument fails -
i error latest versions of clang , gcc code:
int main() { auto lambda = [] (auto = [] {}) {}; lambda(); } clang gives error:
prog.cc: in function 'int main()': prog.cc:3:12: error: no match call '(main()::<lambda(auto:1)>) ()' lambda(); ^ prog.cc:2:35: note: candidate: template<class auto:1> main()::<lambda(auto:1)> auto lambda = [] (auto = [] {}) {}; ^ prog.cc:2:35: note: template argument deduction/substitution failed: prog.cc:3:12: note: couldn't deduce template parameter 'auto:1' lambda(); ^ why fail?
type deduction auto not consider default arguments.
Comments
Post a Comment