[Bug c++/85498] New: Unable to resolve function name with inferred return type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85498 Bug ID: 85498 Summary: Unable to resolve function name with inferred return type Product: gcc Version: 7.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at dcousens dot com Target Milestone: --- gcc version 7.3.1 20180312 (GCC) But, this fails on many different GCC versions. https://godbolt.org/g/G5gEx2 **Expected:** Compilation should succeed (like other compilers, MSVC, Clang, etc) **Actual:** Compilation failed ``` template auto foo (T t) { return t; } template void bar (const T) {} int main () { bar(foo); } ``` Result: ``` : In function 'int main()': :10:17: error: no matching function for call to 'bar()' bar(foo); ^ :7:6: note: candidate: template void bar(T) void bar (const T) {} ^~~ :7:6: note: template argument deduction/substitution failed: :10:17: note: couldn't deduce template parameter 'T' bar(foo); ^ Compiler returned: 1 ```
[Bug c++/85499] New: Unable to resolve function with inferred return type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85499 Bug ID: 85499 Summary: Unable to resolve function with inferred return type Product: gcc Version: 7.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at dcousens dot com Target Milestone: --- gcc version 7.3.1 20180312 (GCC) But, this fails on many different GCC versions. https://godbolt.org/g/G5gEx2 **Expected:** Compilation should succeed (like other compilers, MSVC, Clang, etc) **Actual:** Compilation failed ``` template auto foo (T t) { return t; } template void bar (const T) {} int main () { bar(foo); } ``` Result: ``` : In function 'int main()': :10:17: error: no matching function for call to 'bar()' bar(foo); ^ :7:6: note: candidate: template void bar(T) void bar (const T) {} ^~~ :7:6: note: template argument deduction/substitution failed: :10:17: note: couldn't deduce template parameter 'T' bar(foo); ^ Compiler returned: 1 ```
[Bug c++/85499] Unable to resolve function with inferred return type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85499 --- Comment #1 from gcc at dcousens dot com --- Instantiating `foo` previously can resolve the issue, but isn't a work-able solution in many cases. ``` int main () { foo(1); bar(foo); } ```