[Bug c++/93317] New: return type deduction fails for templated unary function
max.kanold@nu-cost.com
gcc-bugzilla@gcc.gnu.org
Sat Jan 18 16:07:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93317
Bug ID: 93317
Summary: return type deduction fails for templated unary
function
Product: gcc
Version: 9.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: max.kanold@nu-cost.com
Target Milestone: ---
The following legal code will not compile as template deduction failed, see
https://godbolt.org/z/AHUHpF
================================
template<typename T>
auto func(const T& t)
// -> T //mentioning the return type works again
{ return t; }
template<typename Func>
void apply(Func f) {}
int main() {
apply(func<int>);
}
================================
As stated, there is a workaround, namely mentioning the return type (only if
possible, of course).
More information about the Gcc-bugs
mailing list