https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68938
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Reduded testcase: ``` struct f { template<class T> f(const T&){} void operator()(int){} }; template<class T> void bar() { auto print = f([&print](int n){ print(n); }); print(1); } int main() { bar<int>(); return 0; } ``` Basically the problem is we resolve the auto type of print during the definition of the template function instead of waiting until instantiation time as f is a non-depedent type.