This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77912] [C++17 feature] class template deduction fails in template functions and generic lambdas


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
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]