This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77912] [C++17 feature] class template deduction fails in template functions and generic lambdas
- From: "jeff.mirwaisi at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 10 Oct 2016 08:19:43 +0000
- Subject: [Bug c++/77912] [C++17 feature] class template deduction fails in template functions and generic lambdas
- Auto-submitted: auto-generated
- References: <bug-77912-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77912
--- Comment #4 from Jeff Mirwaisi <jeff.mirwaisi at gmail dot com> ---
//To clarify:
template<class T struct S{S(T){}};
template<class T> void f(T t){ S(t); } //deduction fails
int main()
{
auto F=[]{};
//bug 77890 - fails
S(F); //this should construct a temporary object deduced as type
S<decltype(F)>
//bug 77912 - fails
[](auto A){
S(A); //this should construct a temporary object deduced as type
S<decltype(A)>
};
//it is not the lambda type that is being used as a constructor argument, its
the
//generic parameter in the lambda function
//worse yet, in the use of:
f( 42 ); //within the body of the template function f, the deduction also
fails, an
//S<int> should be deduced
}