https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77912
Bug ID: 77912 Summary: class template deduction fails in template functions and generic lambdas Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jeff.mirwaisi at gmail dot com Target Milestone: --- //deduction for the template type parameter of the simple class template below //fails when used in a generic context template<class T> struct S{S(T){}}; //error: invalid use of template type parameter 'S' template<class T> auto f(T t){return S(t);} int main() { //fails f(42); //fails //error: invalid use of template type parameter 'S' [](auto a){return S(a);}(42); //works [](int a){return S(a);}(42); }