[Bug c++/96361] New: return type not deduced for a function template specialization given as argument of a template function
okannen at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jul 28 19:51:58 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96361
Bug ID: 96361
Summary: return type not deduced for a function template
specialization given as argument of a template
function
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: okannen at gmail dot com
Target Milestone: ---
This bug exist since GCC 6.1 and is still present in version GCC 10.2
The following code should compile:
template <class T>
auto f(T v){
return v+v;
}
template <class T>
void g(T && v);
void h(){
g(f<int>); //Error
}
GCC error message is: no matching function for call to 'g(<unresolved
overloaded function type>)'
There is no error if the return type of f is not deduced or if some code
is used to force the return type deduction. For exemple if the function h is
changed to:
void h(){
using x = decltype (f<int>);
g(f<int>); // No error
}
the code compile.
More information about the Gcc-bugs
mailing list